1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-11-01 23:07:55 +01:00
Commit graph

33983 commits

Author SHA1 Message Date
Michael Haggerty
2fbd4f92fa lockfile: fix buffer overflow in path handling
The path of the file to be locked is held in lock_file::filename,
which is a fixed-length buffer of length PATH_MAX.  This buffer is
also (temporarily) used to hold the path of the lock file, which is
the path of the file being locked plus ".lock".  Because of this, the
path of the file being locked must be less than (PATH_MAX - 5)
characters long (5 chars are needed for ".lock" and one character for
the NUL terminator).

On entry into lock_file(), the path length was only verified to be
less than PATH_MAX characters, not less than (PATH_MAX - 5)
characters.

When and if resolve_symlink() is called, then that function is
correctly told to treat the buffer as (PATH_MAX - 5) characters long.
This part is correct.  However:

* If LOCK_NODEREF was specified, then resolve_symlink() is never
  called.

* If resolve_symlink() is called but the path is not a symlink, then
  the length check is never applied.

So it is possible for a path with length (PATH_MAX - 5 <= len <
PATH_MAX) to make it through the checks.  When ".lock" is strcat()ted
to such a path, the lock_file::filename buffer is overflowed.

Fix the problem by adding a check when entering lock_file() that the
original path is less than (PATH_MAX - 5) characters.

[jc: with independent development by Peff]

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-07 10:29:28 -07:00
René Scharfe
3bdb5b9f1f diffcore-pickaxe: simplify has_changes and contains
Halve the number of callsites of contains() to two using temporary
variables, simplifying the code.  While at it, get rid of the
diff_options parameter, which became unused with 8fa4b09f.

Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-07 10:24:11 -07:00
Fraser Tweedale
8240943bd7 diff-options: document default similarity index
The default similarity index of 50% is documented in gitdiffcore(7)
but it is worth also mentioning it in the description of the
-M/--find-renames option.

Signed-off-by: Fraser Tweedale <frase@frase.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 23:14:37 -07:00
Alexey Shumkin
37eb772ef3 t4205 (log-pretty-formats): avoid using sed
For testing truncated log messages 'commit_msg' function uses `sed` to
cut a message. On various platforms `sed` behaves differently and
results of its work depend on locales installed. So, avoid using `sed`.
Use predefined expected outputs instead of calculated ones.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 11:54:53 -07:00
Alexey Shumkin
0fe6df3ce8 t6006 (rev-list-format): add tests for "%b" and "%s" for the case i18n.commitEncoding is not set
In de6029a (pretty: Add failing tests: --format output should honor
logOutputEncoding, 2013-06-26) 'complex-subject' test was changed.
Revert it back, because that change actually removed tests for "%b"
and "%s" with i18n.commitEncoding set.  Also, add two more tests for
mentioned above "%b" and "%s" to test encoding conversions with no
i18n.commitEncoding set.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Suggested-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 11:43:28 -07:00
Alexey Shumkin
17cc2ef1c5 t4205, t6006, t7102: make functions better readable
Function 'test_format' has become harder to read after its change in
de6029a2 (pretty: Add failing tests: --format output should honor
logOutputEncoding, 2013-06-26). Simplify it by moving its "should we
expect it to fail?" parameter to the end.

Note, current code does not use this last parameter as far as there
are no tests expected to fail. We can keep that for future use.

Also, reformat comments.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Improved-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 11:40:18 -07:00
Alexey Shumkin
f3445f781f t4205 (log-pretty-formats): revert back single quotes
In previuos commit de6029a (pretty: Add failing tests: --format output
should honor logOutputEncoding, 2013-06-26) single quotes were replaced
with double quotes to make "$(commit_msg)" expression in heredoc to
work. The same effect can be achieved by using "EOF" as a heredoc
delimiter instead of "\EOF".

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Suggested-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 11:35:39 -07:00
Junio C Hamano
f8abaebab3 Merge branch 'maint'
* maint:
  fixup-builtins: retire an old transition helper script
2013-07-05 01:16:27 -07:00
Junio C Hamano
04f2ddda84 Merge branch 'tr/test-v-and-v-subtest-only'
Allows N instances of tests run in parallel, each running 1/N parts
of the test suite under Valgrind, to speed things up.

* tr/test-v-and-v-subtest-only:
  perf-lib: fix start/stop of perf tests
  test-lib: support running tests under valgrind in parallel
  test-lib: allow prefixing a custom string before "ok N" etc.
  test-lib: valgrind for only tests matching a pattern
  test-lib: verbose mode for only tests matching a pattern
  test-lib: self-test that --verbose works
  test-lib: rearrange start/end of test_expect_* and test_skip
  test-lib: refactor $GIT_SKIP_TESTS matching
  test-lib: enable MALLOC_* for the actual tests
2013-07-05 01:15:48 -07:00
Mark Levedahl
9443605b5d test-lib.sh - cygwin does not have usable FIFOs
Do not use FIFOs on cygwin, they do not work. Cygwin includes
coreutils, so has mkfifo, and that command does something. However,
the resultant named pipe is known (on the Cygwin mailing list at
least) to not work correctly.

This disables PIPE for Cygwin, allowing t0008.sh to complete (all other
tests in that file work correctly).

Signed-off-by: Mark Levedahl <mlevedahl@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 00:06:22 -07:00
Alexey Shumkin
14332bccc1 t4041, t4205, t6006, t7102: use iso8859-1 rather than iso-8859-1
Both "iso8859-1" and "iso-8859-1" are understood as latin-1 by
modern platforms, but the latter is not understood by older
platforms;update tests to use the former.

This is in line with 3994e8a9 (t4201: use ISO8859-1 rather than
ISO-8859-1, 2009-12-03), which did the same.

Signed-off-by: Alexey Shumkin <Alex.Crezoff@gmail.com>
Reviewed-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-05 00:05:00 -07:00
Tony Finch
ad9c2e22ca gitweb: allow extra breadcrumbs to prefix the trail
There are often parent pages logically above the gitweb projects
list, e.g. home pages of the organization and department that host
the gitweb server. This change allows you to include links to those
pages in gitweb's breadcrumb trail.

Signed-off-by: Tony Finch <dot@dotat.at>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-04 21:52:15 -07:00
Ramkumar Ramachandra
531c8dd4fb fixup-builtins: retire an old transition helper script
This script was added in 36e5e70 (Start deprecating "git-command" in
favor of "git command", 2007-06-30) with the intent of aiding the
transition away from dashed forms.

It has already been used to help the transision and served its
purpose, and is no longer very useful for follow-up work, because
the majority of remaining matches it finds are false positives.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 22:47:53 -07:00
Junio C Hamano
56df44a987 Merge branch 'maint'
* maint:
  Update draft release notes to 1.8.3.3
  git-config: update doc for --get with multiple values
2013-07-03 15:43:49 -07:00
Junio C Hamano
81a199bb1c Update draft release notes to 1.8.3.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 15:43:41 -07:00
Junio C Hamano
4efd16543f Merge branch 'rr/diffcore-pickaxe-doc' into maint
* rr/diffcore-pickaxe-doc:
  diffcore-pickaxe doc: document -S and -G properly
  diffcore-pickaxe: make error messages more consistent
2013-07-03 15:41:17 -07:00
Junio C Hamano
213d25648a Merge branch 'cr/git-work-tree-sans-git-dir' into maint
* cr/git-work-tree-sans-git-dir:
  git.txt: remove stale comment regarding GIT_WORK_TREE
2013-07-03 15:41:05 -07:00
Junio C Hamano
ac5611a1cc Merge branch 'fc/do-not-use-the-index-in-add-to-index' into maint
* fc/do-not-use-the-index-in-add-to-index:
  read-cache: trivial style cleanups
  read-cache: fix wrong 'the_index' usage
2013-07-03 15:40:38 -07:00
Junio C Hamano
a256a58081 Merge branch 'dm/unbash-subtree' into maint
* dm/unbash-subtree:
  contrib/git-subtree: Use /bin/sh interpreter instead of /bin/bash
2013-07-03 15:39:37 -07:00
Junio C Hamano
8dbc03933d Merge branch 'jc/core-checkstat' into maint
* jc/core-checkstat:
  deprecate core.statinfo at Git 2.0 boundary
2013-07-03 15:39:15 -07:00
Junio C Hamano
0bdae5ff7d Merge branch 'jc/t5551-posix-sed-bre' into maint
* jc/t5551-posix-sed-bre:
  t5551: do not use unportable sed '\+'
2013-07-03 15:37:58 -07:00
Junio C Hamano
e9fee67fac Merge branch 'vv/help-unknown-ref' into maint
* vv/help-unknown-ref:
  merge: use help_unknown_ref()
  help: add help_unknown_ref()
2013-07-03 15:37:50 -07:00
Junio C Hamano
250ee16c14 Merge branch 'rs/empty-archive' into maint
* rs/empty-archive:
  t5004: resurrect original empty tar archive test
  t5004: avoid using tar for checking emptiness of archive

Conflicts:
	t/t5004-archive-corner-cases.sh
2013-07-03 15:36:54 -07:00
Junio C Hamano
15afe9596c Merge branch 'rh/merge-options-doc-fix' into maint
* rh/merge-options-doc-fix:
  Documentation/merge-options.txt: restore `-e` option
2013-07-03 15:36:30 -07:00
Junio C Hamano
c9d9a2d6b6 Merge branch 'an/diff-index-doc' into maint
* an/diff-index-doc:
  Documentation/diff-index: mention two modes of operation
2013-07-03 15:35:55 -07:00
Junio C Hamano
897175f107 Merge branch 'cm/gitweb-project-list-persistent-cgi-fix' into maint
"gitweb" forgot to clear a global variable $search_regexp upon each
request, mistakenly carrying over the previous search to a new one
when used as a persistent CGI.

* cm/gitweb-project-list-persistent-cgi-fix:
  gitweb: fix problem causing erroneous project list
2013-07-03 15:31:36 -07:00
Junio C Hamano
4b0d73f33d Merge branch 'ar/wildmatch-foldcase' into maint
The wildmatch engine did not honor WM_CASEFOLD option correctly.

* ar/wildmatch-foldcase:
  wildmatch: properly fold case everywhere
2013-07-03 15:31:27 -07:00
Junio C Hamano
318e758f32 Merge branch 'cb/log-follow-with-combined' into maint
"git log -c --follow $path" segfaulted upon hitting the commit that
renamed the $path being followed.

* cb/log-follow-with-combined:
  fix segfault with git log -c --follow
2013-07-03 15:30:59 -07:00
Junio C Hamano
b3bf469bf8 Merge branch 'rr/die-on-missing-upstream' into maint
When a reflog notation is used for implicit "current branch", we did
not say which branch, and worse said "branch ''".

* rr/die-on-missing-upstream:
  sha1_name: fix error message for @{<N>}, @{<date>}
  sha1_name: fix error message for @{u}
2013-07-03 15:30:24 -07:00
Junio C Hamano
dfc6b040d0 Merge branch 'maint-1.8.2' into maint
* maint-1.8.2:
  git-config: update doc for --get with multiple values
2013-07-03 15:27:19 -07:00
Junio C Hamano
f59bebb78e Merge branch 'maint-1.8.1' into maint-1.8.2
* maint-1.8.1:
  git-config: update doc for --get with multiple values
2013-07-03 15:26:53 -07:00
Michael Schubert
d6ac1d2120 Change "remote tracking" to "remote-tracking"
Fix a typo ("remote remote-tracking") going back to the big cleanup
in 2010 (8b3f3f84 etc). Also, remove some more occurrences of
"tracking" and "remote tracking" in favor of "remote-tracking".

Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Reviewed-by: Johan Herland <johan@herland.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 13:27:15 -07:00
Matthieu Moy
0e7c41c0cd git-remote-mediawiki: un-brace file handles in binmode calls
Commit e83d36b66f turned "print STDOUT" into "print {*STDOUT}", as
suggested by perlcritic. Unfortunately, it also changed two "binmode
STDOUT" calls the same way, which does not work and yield a "Not a GLOB
reference" error.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 12:10:13 -07:00
John Keeping
62e91efafd git-config: update doc for --get with multiple values
Since commit 00b347d (git-config: do not complain about duplicate
entries, 2012-10-23), "git config --get" does not exit with an error if
there are multiple values for the specified key but instead returns the
last value.  Update the documentation to reflect this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-03 11:48:15 -07:00
Arnaud Fontaine
db2b3b820e Do not ignore merge options in interactive rebase
Merge strategy and its options can be specified in `git rebase`,
but with `--interactive`, they were completely ignored.

Signed-off-by: Arnaud Fontaine <arnau@debian.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-02 12:46:30 -07:00
Junio C Hamano
94d75d1ed5 get_short_sha1(): correctly disambiguate type-limited abbreviation
One test in t1512 that expects a failure incorrectly passed.  The
test prepares a commit whose object name begins with ten "0"s, and
also prepares a tag that points at the commit.  The object name of
the tag also begins with ten "0"s.  There is no other commit-ish
object in the repository whose name begins with such a prefix.

Ideally, in such a repository:

    $ git rev-parse --verify 0000000000^{commit}

should yield that commit.  If 0000000000 is taken as the commit
0000000000e4f, peeling it to a commmit yields that commit itself,
and if 0000000000 is taken as the tag 0000000000f8f, peeling it to a
commit also yields the same commit, so in that twisted sense, the
extended SHA-1 expression 0000000000^{commit} is unambigous.  The
test that expects a failure is to check the above command.

The reason the test expects a failure is that we did not implement
such a "unification" of two candidate objects.  What we did (or at
least, meant to) implement was to recognise that a commit-ish is
required to expand 0000000000, and notice that there are two succh
commit-ish, and diagnose the request as ambiguous.

However, there was a bug in the logic to check the candidate
objects.  When the code saw 0000000000f8f (a tag) that shared the
shortened prefix (ten "0"s), it tried to make sure that the tag is a
commit-ish by looking at the tag object.  Because it incorrectly
used lookup_object() when the tag has not been parsed, however, we
incorrectly declared that the tag is _not_ a commit-ish, leaving the
sole commit in the repository, 0000000000e4f, that has the required
prefix as "unique match", causing the test to pass when it shouldn't.

This fixes the logic to inspect the type of the object a tag refers
to, to make the test that is expected to fail correctly fail.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01 21:54:45 -07:00
Junio C Hamano
2c57f7c9a2 t1512: correct leftover constants from earlier edition
The earliest iteration of this test script used a magic string
110282 as the common prefix for ambiguous object names, but the
final edition switched the common prefix to 0000000000 (10 "0"s).

Unfortunately, instances of the original prefix were left in the
comments and a few tests.  Replace them with the correct constants.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01 21:54:27 -07:00
Petr Baudis
a73653130e git stash: avoid data loss when "git stash save" kills a directory
"stash save" is about saving the local change to the working tree,
but also about restoring the state of the last commit to the working
tree.  When a local change is to turn a non-directory to a directory,
in order to restore the non-directory, everything in the directory
needs to be removed.

Which is fine when running "git stash save --include-untracked",
but without that option, untracked, newly created files in the
directory will have to be discarded, if the state you are restoring
to has a non-directory at the same path as the directory.

Introduce a safety valve to fail the operation in such case, using
the "ls-files --killed" which was designed for this exact purpose.

The "stash save" is stopped when untracked files need to be
discarded because their leading path ceased to be a directory, and
the user is required to pass --force to really have the data
removed.

Signed-off-by: Petr Baudis <pasky@ucw.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01 14:23:24 -07:00
Junio C Hamano
26c986e118 treat_directory(): do not declare submodules to be untracked
When the working tree walker encounters a directory, it asks the
function treat_directory() if it should descend into it, show it as
an untracked directory, or do something else.  When the directory is
the top of the submodule working tree, we used to say "That is an
untracked directory", which was bogus.

It is an entity that is tracked in the index of the repository we
are looking at, and that is not to be descended into it.  Return
path_none, not path_untracked, to report that.

The existing case that path_untracked is returned for a newly
discovered submodule that is not tracked in the index (this only
happens when DIR_NO_GITLINKS option is not used) is unchanged, but
that is exactly because the submodule is not tracked in the index.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01 14:23:24 -07:00
Junio C Hamano
8c4e4ec3ff Merge branch 'maint'
* maint:
  t7500: fix flipped actual/expect
  lib-rebase: document exec_ in FAKE_LINES
2013-07-01 12:46:54 -07:00
Junio C Hamano
51f11d69b1 Update draft release notes to 1.8.4
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-07-01 12:46:41 -07:00
Junio C Hamano
7e5ad06f68 Merge branch 'rr/remote-branch-config-refresh'
The original way to specify remote repository using .git/branches/
used to have a nifty feature.  The code to support the feature was
still in a function but the caller was changed not to call it 5
years ago, breaking that feature and leaving the supporting code
unreachable.

* rr/remote-branch-config-refresh:
  t/t5505-remote: test multiple push/pull in remotes-file
  ls-remote doc: don't encourage use of branches-file
  ls-remote doc: rewrite <repository> paragraph
  ls-remote doc: fix example invocation on git.git
  t/t5505-remote: test url-with-# in branches-file
  remote: remove dead code in read_branches_file()
  t/t5505-remote: use test_path_is_missing
  t/t5505-remote: test push-refspec in branches-file
  t/t5505-remote: modernize style
2013-07-01 12:41:58 -07:00
Junio C Hamano
46b045917c Merge branch 'ed/color-prompt'
Code clean-up for in-prompt status script (in contrib/).

* ed/color-prompt:
  git-prompt.sh: add missing information in comments
  git-prompt.sh: do not print duplicate clean color code
  t9903: remove redundant tests
  git-prompt.sh: refactor colored prompt code
  t9903: add tests for git-prompt pcmode
2013-07-01 12:41:55 -07:00
Junio C Hamano
eb3a4fc149 Merge branch 'ap/rebase-multiple-fixups'
Having multiple "fixup!" on a line in the rebase instruction sheet
did not work very well with "git rebase -i --autosquash".

* ap/rebase-multiple-fixups:
  lib-rebase: style: use write_script, <<-\EOF
  rebase -i: handle fixup! fixup! in --autosquash
2013-07-01 12:41:52 -07:00
Junio C Hamano
4b9a0deddc Merge branch 'kb/am-deprecate-resolved'
Promote "git am --continue" over "git am --resolved" for UI
consistency.

* kb/am-deprecate-resolved:
  am: replace uses of --resolved with --continue
2013-07-01 12:41:48 -07:00
Junio C Hamano
66929c423a Merge branch 'rr/column-doc'
* rr/column-doc:
  column doc: rewrite documentation for column.ui
2013-07-01 12:41:46 -07:00
Junio C Hamano
43f25ae7b8 Merge branch 'ft/doc-git-transport'
* ft/doc-git-transport:
  documentation: add git:// transport security notice
2013-07-01 12:41:43 -07:00
Junio C Hamano
22930a0a8d Merge branch 'sb/mailmap-merijn-brand'
* sb/mailmap-merijn-brand:
  .mailmap: Map "H.Merijn Brand" to "H. Merijn Brand"
2013-07-01 12:41:41 -07:00
Junio C Hamano
693502087e Merge branch 'sg/bash-prompt'
* sg/bash-prompt:
  bash prompt: mention that PROMPT_COMMAND mode is faster
  bash prompt: avoid command substitution when finalizing gitstring
  bash prompt: avoid command substitution when checking for untracked files
  bash prompt: use bash builtins to check stash state
  bash prompt: use bash builtins to check for unborn branch for dirty state
  bash prompt: combine 'git rev-parse' for detached head
  bash prompt: combine 'git rev-parse' executions in the main code path
  bash prompt: use bash builtins to find out current branch
  bash prompt: use bash builtins to find out rebase state
  bash prompt: run 'git rev-parse --git-dir' directly instead of __gitdir()
  bash prompt: return early from __git_ps1() when not in a git repository
  bash prompt: print unique detached HEAD abbreviated object name
  bash prompt: add a test for symbolic link symbolic refs
  completion, bash prompt: move __gitdir() tests to completion test suite
  bash prompt: use 'write_script' helper in interactive rebase test
  bash prompt: fix redirection coding style in tests
2013-07-01 12:41:37 -07:00
Junio C Hamano
0d07e98e74 Merge branch 'wk/doc-in-linux-3.x-era'
Update documentation to match more recent realities.

* wk/doc-in-linux-3.x-era:
  Documentation: Update 'linux-2.6.git' -> 'linux.git'
  Documentation: Update the NFS remote examples to use the staging repo
  doc/clone: Pick more compelling paths for the --reference example
  doc/clone: Remove the '--bare -l -s' example
2013-07-01 12:41:34 -07:00