8 years agocompat/fnmatch: update old-style definition to ANSI
Junio C Hamano [Wed, 19 Dec 2012 16:54:25 +0000 (08:54 -0800)]
compat/fnmatch: update old-style definition to ANSI

We try to avoid touching borrowed code, but we encourage people to
write without old-style definition and compile with -Werror these
days, and on platforms that need to use NO_FNMATCH, these three
functions make the compilation fail.

Signed-off-by: Junio C Hamano <>
8 years agot7004: do not create unneeded gpghome/gpg.conf when GPG is not used
Junio C Hamano [Tue, 18 Dec 2012 19:26:24 +0000 (11:26 -0800)]
t7004: do not create unneeded gpghome/gpg.conf when GPG is not used

These tests themselves are properly protected by the GPG
prerequisite, but one of the set-up steps outside the
test_expect_success block unconditionally assumed that there is a
gpghome/ directory, which is not true if GPG is not being used.

It may be a good idea to move the whole set-up steps in the test but
that is a follow-up topic.

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'jk/pickaxe-textconv' into maint
Junio C Hamano [Tue, 18 Dec 2012 18:50:07 +0000 (10:50 -0800)]
Merge branch 'jk/pickaxe-textconv' into maint

"git log -p -S<string>" now looks for the <string> after applying
the textconv filter (if defined); earlier it inspected the contents
of the blobs without filtering.

8 years agoclarify -M without % symbol in diff-options
Sitaram Chamarty [Tue, 18 Dec 2012 10:47:09 +0000 (16:17 +0530)]
clarify -M without % symbol in diff-options

Signed-off-by: Sitaram Chamarty <>
Signed-off-by: Junio C Hamano <>
8 years agoFix sizeof usage in get_permutations
Matthew Daley [Thu, 13 Dec 2012 13:36:30 +0000 (02:36 +1300)]
Fix sizeof usage in get_permutations

Currently it gets the size of an otherwise unrelated, unused variable
instead of the expected struct size.

Signed-off-by: Matthew Daley <>
Signed-off-by: Junio C Hamano <>
8 years agogit.txt: add missing info about --git-dir command-line option
Manlio Perillo [Thu, 13 Dec 2012 17:57:19 +0000 (18:57 +0100)]
git.txt: add missing info about --git-dir command-line option

Unlike other environment variables (e.g. GIT_WORK_TREE, GIT_NAMESPACE),
the Documentation/git.txt file did not mention that the GIT_DIR
environment variable can also be set using the --git-dir command line

Signed-off-by: Manlio Perillo <>
Signed-off-by: Junio C Hamano <>
8 years agogit-prompt: Document GIT_PS1_DESCRIBE_STYLE
Anders Kaseorg [Tue, 11 Dec 2012 23:20:24 +0000 (18:20 -0500)]
git-prompt: Document GIT_PS1_DESCRIBE_STYLE

GIT_PS1_DESCRIBE_STYLE was introduced in v1.6.3.2~35.  Document it in the
header comments.

Signed-off-by: Anders Kaseorg <>
Signed-off-by: Junio C Hamano <>
8 years agoGit v1.8.0.2
Junio C Hamano [Mon, 10 Dec 2012 21:05:47 +0000 (13:05 -0800)]

Signed-off-by: Junio C Hamano <>
8 years agoDocumentation/git-stash.txt: add a missing verb
Sébastien Loriot [Mon, 10 Dec 2012 07:22:34 +0000 (08:22 +0100)]
Documentation/git-stash.txt: add a missing verb

Signed-off-by: Sébastien Loriot <>
Signed-off-by: Junio C Hamano <>
8 years agogit(1): remove a defunct link to "list of authors"
Junio C Hamano [Fri, 7 Dec 2012 17:54:50 +0000 (09:54 -0800)]
git(1): remove a defunct link to "list of authors"

The linked page has not been showing the promised "more complete
list" for more than 6 months by now, and nobody has resurrected
the list there nor elsewhere since then.

Signed-off-by: Junio C Hamano <>
8 years agoUpdate draft release notes to
Junio C Hamano [Fri, 7 Dec 2012 22:16:38 +0000 (14:16 -0800)]
Update draft release notes to

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'jc/doc-push-satellite' into maint
Junio C Hamano [Fri, 7 Dec 2012 22:11:21 +0000 (14:11 -0800)]
Merge branch 'jc/doc-push-satellite' into maint

* jc/doc-push-satellite:
  Documentation/git-push.txt: clarify the "push from satellite" workflow

8 years agoMerge branch 'jc/same-encoding' into maint
Junio C Hamano [Fri, 7 Dec 2012 22:10:56 +0000 (14:10 -0800)]
Merge branch 'jc/same-encoding' into maint

Various codepaths checked if two encoding names are the same using
ad-hoc code and some of them ended up asking iconv() to convert
between "utf8" and "UTF-8".  The former is not a valid way to spell
the encoding name, but often people use it by mistake, and we
equated them in some but not all codepaths. Introduce a new helper
function to make these codepaths consistent.

* jc/same-encoding:
  reencode_string(): introduce and use same_encoding()

8 years agoMerge branch 'lt/diff-stat-show-0-lines' into maint
Junio C Hamano [Fri, 7 Dec 2012 22:10:17 +0000 (14:10 -0800)]
Merge branch 'lt/diff-stat-show-0-lines' into maint

"git diff --stat" miscounted the total number of changed lines when
binary files were involved and hidden beyond --stat-count.  It also
miscounted the total number of changed files when there were
unmerged paths.

* lt/diff-stat-show-0-lines:
  t4049: refocus tests
  diff --shortstat: do not count "unmerged" entries
  diff --stat: do not count "unmerged" entries
  diff --stat: move the "total count" logic to the last loop
  diff --stat: use "file" temporary variable to refer to data->files[i]
  diff --stat: status of unmodified pair in diff-q is not zero
  test: add failing tests for "diff --stat" to t4049
  Fix "git diff --stat" for interesting - but empty - file changes

8 years agogit-fast-import.txt: improve documentation for quoted paths
Matthieu Moy [Thu, 29 Nov 2012 19:11:32 +0000 (20:11 +0100)]
git-fast-import.txt: improve documentation for quoted paths

The documentation mentioned only newlines and double quotes as
characters needing escaping, but the backslash also needs it. Also, the
documentation was not clearly saying that double quotes around the file
name were required (double quotes in the examples could be interpreted as
part of the sentence, not part of the actual string).

Signed-off-by: Matthieu Moy <>
Signed-off-by: Junio C Hamano <>
8 years agogit-remote-mediawiki: escape ", \, and LF in file names
Matthieu Moy [Thu, 29 Nov 2012 17:00:55 +0000 (18:00 +0100)]
git-remote-mediawiki: escape ", \, and LF in file names

A mediawiki page can contain, and even start with a " character, we have
to escape it when generating the fast-export stream, as well as \
character. While we're there, also escape newlines, but I don't think we
can get them from MediaWiki pages.

Signed-off-by: Matthieu Moy <>
Signed-off-by: Junio C Hamano <>
8 years agot4049: refocus tests
Junio C Hamano [Thu, 29 Nov 2012 17:46:30 +0000 (09:46 -0800)]
t4049: refocus tests

The primary thing Linus's patch wanted to change was to make sure
that 0-line change appears for a mode-only change.  Update the
first test to chmod a file that we can see in the output (limited
by --stat-count) to demonstrate it.  Also make sure to use test_chmod
and compare the index and the tree, so that we can run this test
even on a filesystem without permission bits.

Later two tests are about fixes to separate issues that were
introduced and/or uncovered by Linus's patch as a side effect, but
the issues are not related to mode-only changes.  Remove chmod from
the tests.

Signed-off-by: Junio C Hamano <>
8 years agoStart preparing for
Junio C Hamano [Wed, 28 Nov 2012 21:40:02 +0000 (13:40 -0800)]
Start preparing for

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'rh/maint-gitweb-highlight-ext' into maint
Junio C Hamano [Wed, 28 Nov 2012 20:05:30 +0000 (12:05 -0800)]
Merge branch 'rh/maint-gitweb-highlight-ext' into maint

Syntax highlighting in "gitweb" was not quite working.

* rh/maint-gitweb-highlight-ext:
  gitweb.perl: fix %highlight_ext mappings

8 years agoMerge branch 'pw/maint-p4-rcs-expansion-newline' into maint
Junio C Hamano [Wed, 28 Nov 2012 20:04:32 +0000 (12:04 -0800)]
Merge branch 'pw/maint-p4-rcs-expansion-newline' into maint

"git p4" used to try expanding malformed "$keyword$" that spans
across multiple lines.

* pw/maint-p4-rcs-expansion-newline:
  git p4: RCS expansion should not span newlines

8 years agocompletion: add options --single-branch and --branch to "git clone"
Ralf Thielow [Wed, 28 Nov 2012 18:27:02 +0000 (19:27 +0100)]
completion: add options --single-branch and --branch to "git clone"

Signed-off-by: Ralf Thielow <>
Signed-off-by: Junio C Hamano <>
8 years agoDocumentation/git-push.txt: clarify the "push from satellite" workflow
Junio C Hamano [Tue, 27 Nov 2012 23:52:27 +0000 (15:52 -0800)]
Documentation/git-push.txt: clarify the "push from satellite" workflow

The context of the example to push into refs/remotes/satellite/
hierarchy of the other repository needs to be spelled out explicitly
for the value of this example to be fully appreciated.  Make it so.

Signed-off-by: Junio C Hamano <>
8 years agodiff --shortstat: do not count "unmerged" entries
Junio C Hamano [Tue, 27 Nov 2012 22:19:36 +0000 (14:19 -0800)]
diff --shortstat: do not count "unmerged" entries

Fix the same issue as the previous one for "git diff --stat";
unmerged entries was doubly-counted.

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'nd/maint-compat-fnmatch-fix' into maint
Junio C Hamano [Tue, 27 Nov 2012 21:29:00 +0000 (13:29 -0800)]
Merge branch 'nd/maint-compat-fnmatch-fix' into maint

* nd/maint-compat-fnmatch-fix:
  compat/fnmatch: fix off-by-one character class's length check

8 years agoMerge branch 'jh/update-ref-d-through-symref' into maint
Junio C Hamano [Tue, 27 Nov 2012 21:28:45 +0000 (13:28 -0800)]
Merge branch 'jh/update-ref-d-through-symref' into maint

* jh/update-ref-d-through-symref:
  Fix failure to delete a packed ref through a symref
  t1400-update-ref: Add test verifying bug with symrefs in delete_ref()

8 years agoMerge branch 'esr/maint-doc-fast-import' into maint
Junio C Hamano [Tue, 27 Nov 2012 21:28:31 +0000 (13:28 -0800)]
Merge branch 'esr/maint-doc-fast-import' into maint

* esr/maint-doc-fast-import:
  doc/fast-import: clarify how content states are built

8 years agoMerge branch 'wtk/submodule-doc-fixup' into maint
Junio C Hamano [Tue, 27 Nov 2012 21:28:18 +0000 (13:28 -0800)]
Merge branch 'wtk/submodule-doc-fixup' into maint

* wtk/submodule-doc-fixup:
  git-submodule: wrap branch option with "<>" in usage strings.

8 years agodiff --stat: do not count "unmerged" entries
Junio C Hamano [Tue, 27 Nov 2012 20:05:10 +0000 (12:05 -0800)]
diff --stat: do not count "unmerged" entries

Even though we show a separate *UNMERGED* entry in the patch and
diffstat output (or in the --raw format, for that matter) in
addition to and separately from the diff against the specified stage
(defaulting to #2) for unmerged paths, they should not be counted in
the total number of files affected---that would lead to counting the
same path twice.

The separation done by the previous step makes this fix simple and
straightforward.  Among the filepairs in diff_queue, paths that
weren't modified, and the extra "unmerged" entries do not count as
total number of files.

Signed-off-by: Junio C Hamano <>
8 years agodiff --stat: move the "total count" logic to the last loop
Junio C Hamano [Tue, 27 Nov 2012 19:47:46 +0000 (11:47 -0800)]
diff --stat: move the "total count" logic to the last loop

The diffstat generation logic, with --stat-count limit, is
implemented as three loops.

 - The first counts the width necessary to show stats up to
   specified number of entries, and notes up to how many entries in
   the data we need to iterate to show the graph;

 - The second iterates that many times to draw the graph, adjusts
   the number of "total modified files", and counts the total
   added/deleted lines for the part that was shown in the graph;

 - The third iterates over the remainder and only does the part to
   count "total added/deleted lines" and to adjust "total modified
   files" without drawing anything.

Move the logic to count added/deleted lines and modified files from
the second loop to the third loop.

This incidentally fixes a bug.  The third loop was not filtering
binary changes (counted in bytes) from the total added/deleted as it
should.  The second loop implemented this correctly, so if a binary
change appeared earlier than the --stat-count cutoff, the code
counted number of added/deleted lines correctly, but if it appeared
beyond the cutoff, the number of lines would have mixed with the
byte count in the buggy third loop.

Signed-off-by: Junio C Hamano <>
8 years agodiff --stat: use "file" temporary variable to refer to data->files[i]
Junio C Hamano [Tue, 27 Nov 2012 19:24:54 +0000 (11:24 -0800)]
diff --stat: use "file" temporary variable to refer to data->files[i]

The generated code shouldn't change but it is easier to read.

Signed-off-by: Junio C Hamano <>
8 years agodiff --stat: status of unmodified pair in diff-q is not zero
Junio C Hamano [Tue, 27 Nov 2012 19:17:14 +0000 (11:17 -0800)]
diff --stat: status of unmodified pair in diff-q is not zero

It is spelled DIFF_STATUS_UNKNOWN these days, and is different from zero.

Signed-off-by: Junio C Hamano <>
8 years agotest: add failing tests for "diff --stat" to t4049
Junio C Hamano [Tue, 27 Nov 2012 20:55:00 +0000 (12:55 -0800)]
test: add failing tests for "diff --stat" to t4049

There are a few problems in diff.c around --stat area, partially
caused by the recent 74faaa1 (Fix "git diff --stat" for interesting
- but empty - file changes, 2012-10-17), and largely caused by the
earlier change that introduced when --stat-count was added.

Add a few test pieces to t4049 to expose the issues.

Signed-off-by: Junio C Hamano <>
8 years agoDocumentation: improve phrasing in git-push.txt
Mark Szepieniec [Tue, 27 Nov 2012 01:37:34 +0000 (01:37 +0000)]
Documentation: improve phrasing in git-push.txt

The current version contains the sentence:

Further suppose that the other person already pushed changes leading to
A back to the original repository you two obtained the original commit

which doesn't parse for me; I've changed it to

Further suppose that the other person already pushed changes leading to
A back to the original repository from which you two obtained the
original commit X.

Signed-off-by: Mark Szepieniec <>
Signed-off-by: Junio C Hamano <>
8 years agoFix typo in remote set-head usage
Antoine Pelisse [Mon, 26 Nov 2012 19:21:54 +0000 (20:21 +0100)]
Fix typo in remote set-head usage

parenthesis are not matching in `builtin_remote_sethead_usage`
as a square bracket is closing something never opened.

Signed-off-by: Antoine Pelisse <>
Signed-off-by: Junio C Hamano <>
8 years agoMakefile: hide stderr of curl-config test
Paul Gortmaker [Thu, 22 Nov 2012 03:19:57 +0000 (22:19 -0500)]
Makefile: hide stderr of curl-config test

You will get

    $ make distclean 2>&1 | grep curl
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found
    /bin/sh: curl-config: not found

if you don't have a curl development package installed.

The intent is not to alarm the user, but just to test if there is
a new enough curl installed.  However, if you look at search engine
suggested completions, the above "error" messages are confusing
people into thinking curl is a hard requirement.

Redirect this error output to /dev/null as it is not necessary to be
shown to the end users.

Signed-off-by: Paul Gortmaker <>
Signed-off-by: Junio C Hamano <>
8 years agoGit v1.8.0.1
Junio C Hamano [Mon, 26 Nov 2012 02:40:34 +0000 (18:40 -0800)]

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'jk/checkout-out-of-unborn' into maint
Junio C Hamano [Mon, 26 Nov 2012 02:35:50 +0000 (18:35 -0800)]
Merge branch 'jk/checkout-out-of-unborn' into maint

* jk/checkout-out-of-unborn:
  checkout: print a message when switching unborn branches

8 years agoMerge branch 'cn/config-missing-path' into maint
Junio C Hamano [Mon, 26 Nov 2012 02:35:46 +0000 (18:35 -0800)]
Merge branch 'cn/config-missing-path' into maint

* cn/config-missing-path:
  config: don't segfault when given --path with a missing value

8 years agoMerge branch 'jk/maint-gitweb-xss' into maint
Junio C Hamano [Mon, 26 Nov 2012 02:35:41 +0000 (18:35 -0800)]
Merge branch 'jk/maint-gitweb-xss' into maint

Fixes an XSS vulnerability in gitweb.

* jk/maint-gitweb-xss:
  gitweb: escape html in rss title

8 years agoCompletion must sort before using uniq
Marc Khouzam [Fri, 23 Nov 2012 14:02:22 +0000 (09:02 -0500)]
Completion must sort before using uniq

The user can be presented with invalid completion results
when trying to complete a 'git checkout' command.  This can happen
when using a branch name prefix that matches multiple remote branches.

For example, if available branches are:

When performing completion on 'git checkout ma' the user will be
given the choices:

However, 'git checkout maint' will fail in this case, although
completion previously said 'maint' was valid.  Furthermore, when
performing completion on 'git checkout mai', no choices will be
suggested.  So, the user is first told that the branch name
'maint' is valid, but when trying to complete 'mai' into 'maint',
that completion is no longer valid.

The completion results should never propose 'maint' as a valid
branch name, since 'git checkout' will refuse it.

The reason for this bug is that the uniq program only
works with sorted input.  The man page states
"uniq prints the unique lines in a sorted file".

When __git_refs uses the guess heuristic employed by checkout for
tracking branches it wants to consider remote branches but only if
the branch name is unique.  To do that, it calls 'uniq -u'.  However
the input given to 'uniq -u' is not sorted.

Therefore, in the above example, when dealing with 'git checkout ma',
"__git_refs '' 1" will find the following list:

which, when passed to 'uniq -u' will remain the same.  Therefore
'maint' will be wrongly suggested as a valid option.

When dealing with 'git checkout mai', the list will be:

which happens to be sorted and will be emptied by 'uniq -u',
properly ignoring 'maint'.

A solution for preventing the completion script from suggesting
such invalid branch names is to first call 'sort' and then 'uniq -u'.

Signed-off-by: Marc Khouzam <>
Reviewed-by: Felipe Contreras <>
Signed-off-by: Junio C Hamano <>
8 years agocompat/fnmatch: fix off-by-one character class's length check
Nguyễn Thái Ngọc Duy [Sun, 11 Nov 2012 10:13:57 +0000 (17:13 +0700)]
compat/fnmatch: fix off-by-one character class's length check

Character class "xdigit" is the only one that hits 6 character limit
defined by CHAR_CLASS_MAX_LENGTH. All other character classes are 5
character long and therefore never caught by this.

This should make xdigit tests in t3070 pass on Windows.

Reported-by: Johannes Sixt <>
Signed-off-by: Nguyễn Thái Ngọc Duy <>
Signed-off-by: Junio C Hamano <>
8 years agoFurther preparation for
Junio C Hamano [Tue, 20 Nov 2012 18:16:14 +0000 (10:16 -0800)]
Further preparation for

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'mg/maint-pull-suggest-upstream-to' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:15:09 +0000 (10:15 -0800)]
Merge branch 'mg/maint-pull-suggest-upstream-to' into maint

* mg/maint-pull-suggest-upstream-to:
  push/pull: adjust missing upstream help text to changed interface

8 years agoMerge branch 'mm/maint-doc-commit-edit' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:14:55 +0000 (10:14 -0800)]
Merge branch 'mm/maint-doc-commit-edit' into maint

* mm/maint-doc-commit-edit:
  Document 'git commit --no-edit' explicitly

8 years agoMerge branch 'as/maint-doc-fix-no-post-rewrite' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:14:46 +0000 (10:14 -0800)]
Merge branch 'as/maint-doc-fix-no-post-rewrite' into maint

* as/maint-doc-fix-no-post-rewrite:
  commit: fixup misplacement of --no-post-rewrite description

8 years agoMerge branch 'rs/lock-correct-ref-during-delete' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:14:41 +0000 (10:14 -0800)]
Merge branch 'rs/lock-correct-ref-during-delete' into maint

* rs/lock-correct-ref-during-delete:
  refs: lock symref that is to be deleted, not its target

8 years agoMerge branch 'rf/maint-mailmap-off-by-one' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:14:28 +0000 (10:14 -0800)]
Merge branch 'rf/maint-mailmap-off-by-one' into maint

* rf/maint-mailmap-off-by-one:
  mailmap: avoid out-of-bounds memory access

8 years agoMerge branch 'jk/maint-diff-grep-textconv' into maint
Junio C Hamano [Tue, 20 Nov 2012 18:03:12 +0000 (10:03 -0800)]
Merge branch 'jk/maint-diff-grep-textconv' into maint

"git diff -G<pattern>" did not honor textconv filter when looking
for changes.

* jk/maint-diff-grep-textconv:
  diff_grep: use textconv buffers for add/deleted files

8 years agoMerge branch 'js/format-2047' into maint
Junio C Hamano [Tue, 20 Nov 2012 17:57:44 +0000 (09:57 -0800)]
Merge branch 'js/format-2047' into maint

Various rfc2047 quoting issues around a non-ASCII name on the From:
line in the output from format-patch have been corrected.

* js/format-2047:
  format-patch tests: check quoting/encoding in To: and Cc: headers
  format-patch: fix rfc2047 address encoding with respect to rfc822 specials
  format-patch: make rfc2047 encoding more strict
  format-patch: introduce helper function last_line_length()
  format-patch: do not wrap rfc2047 encoded headers too late
  format-patch: do not wrap non-rfc2047 headers too early
  utf8: fix off-by-one wrapping of text

8 years agoStart preparing for
Junio C Hamano [Mon, 19 Nov 2012 03:47:19 +0000 (19:47 -0800)]
Start preparing for

Signed-off-by: Junio C Hamano <>
8 years agoMerge branch 'sz/maint-curl-multi-timeout' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:44:36 +0000 (19:44 -0800)]
Merge branch 'sz/maint-curl-multi-timeout' into maint

Sometimes curl_multi_timeout() function suggested a wrong timeout
value when there is no file descriptors to wait on and the http
transport ended up sleeping for minutes in select(2) system call.  A
workaround has been added for this.

* sz/maint-curl-multi-timeout:
  Fix potential hang in https handshake

8 years agoMerge branch 'po/maint-refs-replace-docs' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:34:09 +0000 (19:34 -0800)]
Merge branch 'po/maint-refs-replace-docs' into maint

The refs/replace hierarchy was not mentioned in the
repository-layout docs.

* po/maint-refs-replace-docs:
  Doc repository-layout: Show refs/replace

8 years agoMerge branch 'ph/pull-rebase-detached' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:33:45 +0000 (19:33 -0800)]
Merge branch 'ph/pull-rebase-detached' into maint

"git pull --rebase" run while the HEAD is detached tried to find
the upstream branch of the detached HEAD (which by definition
does not exist) and emitted unnecessary error messages.

* ph/pull-rebase-detached:
  git-pull: Avoid merge-base on detached head

8 years agoMerge branch 'mm/maint-doc-remote-tracking' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:33:20 +0000 (19:33 -0800)]
Merge branch 'mm/maint-doc-remote-tracking' into maint

Update "remote tracking branch" in the documentation to
"remote-tracking branch".

* mm/maint-doc-remote-tracking:
  Documentation: remote tracking branch -> remote-tracking branch

8 years agoMerge branch 'rs/branch-del-symref' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:32:58 +0000 (19:32 -0800)]
Merge branch 'rs/branch-del-symref' into maint

A symbolic ref refs/heads/SYM was not correctly removed with "git
branch -d SYM"; the command removed the ref pointed by SYM instead.

* rs/branch-del-symref:
  branch: show targets of deleted symrefs, not sha1s
  branch: skip commit checks when deleting symref branches
  branch: delete symref branch, not its target
  branch: factor out delete_branch_config()
  branch: factor out check_branch_commit()

8 years agoMerge branch 'nd/grep-true-path' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:32:30 +0000 (19:32 -0800)]
Merge branch 'nd/grep-true-path' into maint

"git grep -e pattern <tree>" asked the attribute system to read
"<tree>:.gitattributes" file in the working tree, which was

* nd/grep-true-path:
  grep: stop looking at random places for .gitattributes

8 years agoMerge branch 'jc/grep-pcre-loose-ends' (early part) into maint
Junio C Hamano [Mon, 19 Nov 2012 03:32:11 +0000 (19:32 -0800)]
Merge branch 'jc/grep-pcre-loose-ends' (early part) into maint

"git log -F -E --grep='<ere>'" failed to use the given <ere>
pattern as extended regular expression, and instead looked for the
string literally.

* 'jc/grep-pcre-loose-ends' (early part):
  log --grep: use the same helper to set -E/-F options as "git grep"
  revisions: initialize revs->grep_filter using grep_init()
  grep: move pattern-type bits support to top-level grep.[ch]
  grep: move the configuration parsing logic to grep.[ch]
  builtin/grep.c: make configuration callback more reusable

8 years agoMerge branch 'da/mergetools-p4' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:31:40 +0000 (19:31 -0800)]
Merge branch 'da/mergetools-p4' into maint

"git mergetool" feeds /dev/null as a common ancestor when dealing
with an add/add conflict, but p4merge backend cannot handle it. Work
it around by passing a temporary empty file.

* da/mergetools-p4:
  mergetools/p4merge: Handle "/dev/null"

8 years agoMerge branch 'jc/test-say-color-avoid-echo-escape' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:31:13 +0000 (19:31 -0800)]
Merge branch 'jc/test-say-color-avoid-echo-escape' into maint

The "say" function in the test scaffolding incorrectly allowed
"echo" to interpret "\a" as if it were a C-string asking for a BEL

* jc/test-say-color-avoid-echo-escape:
  test-lib: Fix say_color () not to interpret \a\b\c in the message

8 years agoMerge branch 'bw/config-lift-variable-name-length-limit' into maint
Junio C Hamano [Mon, 19 Nov 2012 03:29:44 +0000 (19:29 -0800)]
Merge branch 'bw/config-lift-variable-name-length-limit' into maint

The configuration parser had an unnecessary hardcoded limit on
variable names that was not checked consistently.

* bw/config-lift-variable-name-length-limit:
  Remove the hard coded length limit on variable names in config files

8 years agoconfig: don't segfault when given --path with a missing value
Carlos Martín Nieto [Thu, 15 Nov 2012 18:10:01 +0000 (10:10 -0800)]
config: don't segfault when given --path with a missing value

When given a variable without a value, such as '[section] var' and
asking git-config to treat it as a path, git_config_pathname returns
an error and doesn't modify its output parameter. show_config assumes
that the call is always successful and sets a variable to indicate
that vptr should be freed. In case of an error however, trying to do
this will cause the program to be killed, as it's pointing to memory
in the stack.

Detect the error and return immediately to avoid freeing or accessing
the uninitialed memory in the stack.

Signed-off-by: Carlos Martín Nieto <>
Acked-by: Jeff King <>
Signed-off-by: Junio C Hamano <>
8 years agocheckout: print a message when switching unborn branches
Jeff King [Thu, 15 Nov 2012 17:12:33 +0000 (09:12 -0800)]
checkout: print a message when switching unborn branches

When we switch to a new branch using checkout, we usually output a
message indicating what happened. However, when we switch from an unborn
branch to a new branch, we do not print anything, which may leave the
user wondering what happened.

The reason is that the unborn branch is a special case (see abe1998),
and does not follow the usual switch_branches code path. Let's add a
similar informational message to the special case to match the usual
code path.

Signed-off-by: Jeff King <>
Signed-off-by: Junio C Hamano <>
8 years agogitweb: escape html in rss title
Jeff King [Mon, 12 Nov 2012 21:34:28 +0000 (16:34 -0500)]
gitweb: escape html in rss title

The title of an RSS feed is generated from many components,
including the filename provided as a query parameter, but we
failed to quote it.  Besides showing the wrong output, this
is a vector for XSS attacks.

Signed-off-by: Jeff King <>
8 years agodoc/fast-import: clarify how content states are built
Eric S. Raymond [Mon, 5 Nov 2012 04:31:01 +0000 (23:31 -0500)]
doc/fast-import: clarify how content states are built

Signed-off-by: Eric S. Raymond <>
Signed-off-by: Jeff King <>
8 years agogitweb.perl: fix %highlight_ext mappings
Richard Hubbell [Sun, 4 Nov 2012 17:45:55 +0000 (09:45 -0800)]
gitweb.perl: fix %highlight_ext mappings

When commit 592ea41 refactored the list of extensions for
syntax highlighting, it failed to take into account perl's
operator precedence within lists. As a result, we end up
creating a dictionary of one-to-one elements when the intent
was to map mutliple related types to one main type (e.g.,
bash, ksh, zsh, and sh should all map to sh since they share
similar syntax, but we ended up just mapping "bash" to
"bash" and so forth).

This patch adds parentheses to make the mapping as the
original change intended. It also reorganizes the list to
keep mapped extensions together.

Signed-off-by: Richard Hubbell <>
Signed-off-by: Jeff King <>
8 years agogit p4: RCS expansion should not span newlines
Pete Wyckoff [Sun, 4 Nov 2012 22:04:02 +0000 (17:04 -0500)]
git p4: RCS expansion should not span newlines

This bug was introduced in cb585a9 (git-p4: keyword
flattening fixes, 2011-10-16).  The newline character
is indeed special, and $File$ expansions should not try
to match across multiple lines.

Based-on-patch-by: Chris Goard <>
Signed-off-by: Pete Wyckoff <>
Signed-off-by: Jeff King <>
8 years agopush/pull: adjust missing upstream help text to changed interface
Michael J Gruber [Tue, 6 Nov 2012 10:29:01 +0000 (11:29 +0100)]
push/pull: adjust missing upstream help text to changed interface

In case of a missing upstream, the git-parse-remote script suggests:

If you wish to set tracking information for this branch you can do so

    git branch --set-upstream nsiv2 origin/<branch>

But --set-upstream is deprectated. Change the suggestion to:

    git branch --set-upstream-to=origin/<branch> nsiv2

Reported-by: Jeroen van der Ham <>
Signed-off-by: Michael J Gruber <>
Signed-off-by: Jeff King <>
8 years agoreencode_string(): introduce and use same_encoding()
Junio C Hamano [Fri, 19 Oct 2012 05:41:56 +0000 (22:41 -0700)]
reencode_string(): introduce and use same_encoding()

Callers of reencode_string() that re-encodes a string from one
encoding to another all used ad-hoc way to bypass the case where the
input and the output encodings are the same.  Some did strcmp(),
some did strcasecmp(), yet some others when converting to UTF-8 used

Introduce same_encoding() helper function to make these callers use
the same logic.  Notably, is_encoding_utf8() has a work-around for
common misconfiguration to use "utf8" to name UTF-8 encoding, which
does not match "UTF-8" hence strcasecmp() would not consider the
same.  Make use of it in this helper function.

Signed-off-by: Junio C Hamano <>
8 years agocommit: fixup misplacement of --no-post-rewrite description
Andreas Schwab [Fri, 2 Nov 2012 12:26:47 +0000 (13:26 +0100)]
commit: fixup misplacement of --no-post-rewrite description

In e858af6 (commit: document a couple of options) the description of the
--no-post-rewrite option was put inside the paragraph for the --amend
option.  Move it down after the paragraph.

Signed-off-by: Andreas Schwab <>
Signed-off-by: Jeff King <>
8 years agoDocument 'git commit --no-edit' explicitly
Matthieu Moy [Fri, 2 Nov 2012 10:39:30 +0000 (11:39 +0100)]
Document 'git commit --no-edit' explicitly

Signed-off-by: Matthieu Moy <>
Signed-off-by: Jeff King <>
8 years agopickaxe: use textconv for -S counting
Jeff King [Sun, 28 Oct 2012 12:27:12 +0000 (08:27 -0400)]
pickaxe: use textconv for -S counting

We currently just look at raw blob data when using "-S" to
pickaxe. This is mostly historical, as pickaxe predates the
textconv feature. If the user has bothered to define a
textconv filter, it is more likely that their search string will be
on the textconv output, as that is what they will see in the
diff (and we do not even provide a mechanism for them to
search for binary needles that contain NUL characters).

This patch teaches "-S" to use textconv, just as we
already do for "-G".

Signed-off-by: Jeff King <>
8 years agopickaxe: hoist empty needle check
Jeff King [Sun, 28 Oct 2012 12:34:06 +0000 (08:34 -0400)]
pickaxe: hoist empty needle check

If we are given an empty pickaxe needle like "git log -S ''",
it is impossible for us to find anything (because no matter
what the content, the count will always be 0). We currently
check this at the lowest level of contains(). Let's hoist
the logic much earlier to has_changes(), so that it is
simpler to return our answer before loading any blob data.

Signed-off-by: Jeff King <>
8 years agodiff_grep: use textconv buffers for add/deleted files
Jeff King [Sun, 28 Oct 2012 11:40:00 +0000 (07:40 -0400)]
diff_grep: use textconv buffers for add/deleted files

If you use "-G" to grep a diff, we will apply a configured
textconv filter to the data before generating the diff.
However, if the diff is an addition or deletion, we do not
bother running the diff at all, and just look for the token
in the added (or removed) content. This works because we
know that the diff must contain every line of content.

However, while we used the textconv-derived buffers in the
regular diff, we accidentally passed the original unmodified
buffers to regexec when checking the added or removed
content. This could lead to an incorrect answer.

Worse, in some cases we might have a textconv buffer but no
original buffer (e.g., if we pulled the textconv data from
cache, or if we reused a working tree file when generating
it). In that case, we could actually feed NULL to regexec
and segfault.

Reported-by: Peter Oberndorfer <>
Signed-off-by: Jeff King <>
8 years agomailmap: avoid out-of-bounds memory access
Romain Francoise [Sat, 27 Oct 2012 22:49:55 +0000 (00:49 +0200)]
mailmap: avoid out-of-bounds memory access

AddressSanitizer (
complains of a one-byte buffer underflow in parse_name_and_email() while
running the test suite. And indeed, if one of the lines in the mailmap
begins with '<', we dereference the address just before the beginning of
the buffer when looking for whitespace to remove, before checking that
we aren't going too far.

So reverse the order of the tests to make sure that we don't read
outside the buffer.

Signed-off-by: Romain Francoise <>
Signed-off-by: Jeff King <>
8 years agoDoc repository-layout: Show refs/replace
Philip Oakley [Sun, 21 Oct 2012 20:52:37 +0000 (21:52 +0100)]
Doc repository-layout: Show refs/replace

Signed-off-by: Philip Oakley <>
Signed-off-by: Jeff King <>
8 years agoDocumentation: remote tracking branch -> remote-tracking branch
Matthieu Moy [Tue, 23 Oct 2012 11:34:05 +0000 (13:34 +0200)]
Documentation: remote tracking branch -> remote-tracking branch

This change was already done by 0e615b252f3 (Matthieu Moy, Tue Nov 2
2010, Replace "remote tracking" with "remote-tracking"), but new
instances of remote tracking (without dash) were introduced in the

Signed-off-by: Matthieu Moy <>
Signed-off-by: Jeff King <>
8 years agogit-pull: Avoid merge-base on detached head
Phil Hord [Tue, 23 Oct 2012 20:39:56 +0000 (16:39 -0400)]
git-pull: Avoid merge-base on detached head

git pull --rebase does some clever tricks to find the base
for $upstream, but it forgets that we may not have any
branch at all.  When this happens, git merge-base reports its
"usage" help in the middle of an otherwise successful
rebase operation, because git-merge is called with one too
few parameters.

Since we do not need the merge-base trick in the case of a
detached HEAD, detect this condition and bypass the clever
trick and the usage noise.

Signed-off-by: Phil Hord <>
Signed-off-by: Jeff King <>
8 years agogit-submodule: wrap branch option with "<>" in usage strings.
W. Trevor King [Tue, 23 Oct 2012 21:00:21 +0000 (17:00 -0400)]
git-submodule: wrap branch option with "<>" in usage strings.

Use "-b <branch>" instead of "-b branch".  This brings the usage
strings in line with other options, e.g. "--reference <repository>".

Signed-off-by: W. Trevor King <>
Signed-off-by: Jeff King <>
8 years agoGit 1.8.0 v1.8.0
Junio C Hamano [Sun, 21 Oct 2012 20:56:23 +0000 (13:56 -0700)]
Git 1.8.0

Signed-off-by: Junio C Hamano <>
8 years agoFix failure to delete a packed ref through a symref
Johan Herland [Sun, 21 Oct 2012 10:40:32 +0000 (12:40 +0200)]
Fix failure to delete a packed ref through a symref

When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD'
to delete refs/heads/master), we would remove the loose ref, but a packed
version of the same ref would remain, the end result being that instead of
deleting refs/heads/master we would appear to reset it to its state as of
the last repack.

This patch fixes the issue, by making sure we pass the correct ref name
when invoking repack_without_ref() from within delete_ref().

Signed-off-by: Johan Herland <>
Signed-off-by: Junio C Hamano <>
8 years agot1400-update-ref: Add test verifying bug with symrefs in delete_ref()
Johan Herland [Sun, 21 Oct 2012 10:40:31 +0000 (12:40 +0200)]
t1400-update-ref: Add test verifying bug with symrefs in delete_ref()

When deleting a ref through a symref (e.g. using 'git update-ref -d HEAD'
to delete refs/heads/master), we currently fail to remove the packed
version of that ref. This testcase demonstrates the bug.

Signed-off-by: Johan Herland <>
Signed-off-by: Junio C Hamano <>
8 years agoFix potential hang in https handshake
Stefan Zager [Fri, 19 Oct 2012 21:04:20 +0000 (14:04 -0700)]
Fix potential hang in https handshake

It has been observed that curl_multi_timeout may return a very long
timeout value (e.g., 294 seconds and some usec) just before
curl_multi_fdset returns no file descriptors for reading.  The
upshot is that select() will hang for a long time -- long enough for
an https handshake to be dropped.  The observed behavior is that
the git command will hang at the terminal and never transfer any

This patch is a workaround for a probable bug in libcurl.  The bug
only seems to manifest around a very specific set of circumstances:

- curl version (from curl/curlver.h):

 #define LIBCURL_VERSION_NUM 0x071307

- git-remote-https running on an ubuntu-lucid VM.
- Connecting through squid proxy running on another VM.

Interestingly, the problem doesn't manifest if a host connects
through squid proxy running on localhost; only if the proxy is on
a separate VM (not sure if the squid host needs to be on a separate
physical machine).  That would seem to suggest that this issue
is timing-sensitive.

This patch is more or less in line with a recommendation in the
curl docs about how to behave when curl_multi_fdset doesn't return
and file descriptors:

Signed-off-by: Stefan Zager <>
Signed-off-by: Junio C Hamano <>
8 years agobranch: show targets of deleted symrefs, not sha1s
René Scharfe [Thu, 18 Oct 2012 12:08:03 +0000 (14:08 +0200)]
branch: show targets of deleted symrefs, not sha1s

git branch reports the abbreviated hash of the head commit of
a deleted branch to make it easier for a user to undo the
operation.  For symref branches this doesn't help.  Print the
symref target instead for them.

Signed-off-by: Rene Scharfe <>
Signed-off-by: Junio C Hamano <>
8 years agobranch: skip commit checks when deleting symref branches
René Scharfe [Thu, 18 Oct 2012 12:07:11 +0000 (14:07 +0200)]
branch: skip commit checks when deleting symref branches

Before a branch is deleted, we check that it points to a valid
commit.  With -d we also check that the commit is a merged; this
check is not done with -D.

The reason for that is that commits pointed to by branches should
never go missing; if they do then something broke and it's better
to stop instead of adding to the mess.  And a non-merged commit
may contain changes that are worth preserving, so we require the
stronger option -D instead of -d to get rid of them.

If a branch consists of a symref, these concerns don't apply.
Deleting such a branch can't make a commit become unreferenced,
so we don't need to check if it is merged, or even if it is
actually a valid commit.  Skip them in that case.  This allows
us to delete dangling symref branches.

Signed-off-by: Rene Scharfe <>
Signed-off-by: Junio C Hamano <>
8 years agobranch: delete symref branch, not its target
René Scharfe [Thu, 18 Oct 2012 12:05:17 +0000 (14:05 +0200)]
branch: delete symref branch, not its target

If a branch that is to be deleted happens to be a symref to another
branch, the current code removes the targeted branch instead of the
one it was called for.

Change this surprising behaviour and delete the symref branch

Signed-off-by: Rene Scharfe <>
Signed-off-by: Junio C Hamano <>
8 years agobranch: factor out delete_branch_config()
René Scharfe [Thu, 18 Oct 2012 12:04:08 +0000 (14:04 +0200)]
branch: factor out delete_branch_config()

Provide a small helper function for deleting branch config sections.

Signed-off-by: Rene Scharfe <>
Signed-off-by: Junio C Hamano <>
8 years agobranch: factor out check_branch_commit()
René Scharfe [Thu, 18 Oct 2012 12:02:51 +0000 (14:02 +0200)]
branch: factor out check_branch_commit()

Move the code to perform checks on the tip commit of a branch
to its own function.

Signed-off-by: Rene Scharfe <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch tests: check quoting/encoding in To: and Cc: headers
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:34 +0000 (16:43 +0200)]
format-patch tests: check quoting/encoding in To: and Cc: headers

git-format-patch does currently not parse user supplied extra header
values (e. g., --cc, --add-header) and just replays them. That forces
users to add them RFC 2822/2047 conform in encoded form, e.g.

    --cc '=?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= <...>'

which is inconvenient. We would want to update git-format-patch to
accept human-readable input

    --cc 'Jan H. Schönherr <...>'

and handle the encoding, wrapping and quoting internally in the future,
similar to what is already done in git-send-email. The necessary code
should mostly exist in the code paths that handle the From: and Subject:

Whether we want to do this only for the git-format-patch options
--to and --cc (and the corresponding config options) or also for
user supplied headers via --add-header, is open for discussion.

For now, add test_expect_failure tests for To: and Cc: headers as a
reminder and fix tests that would otherwise fail should this get

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch: fix rfc2047 address encoding with respect to rfc822 specials
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:33 +0000 (16:43 +0200)]
format-patch: fix rfc2047 address encoding with respect to rfc822 specials

According to RFC 2047 and RFC 822, rfc2047 encoded words and and rfc822
quoted strings do not mix. Since add_rfc2047() no longer leaves RFC 822
specials behind, the quoting is also no longer necessary to create a
standard-conforming mail.

Remove the quoting, when RFC 2047 encoding takes place. This actually
requires to refactor add_rfc2047() a bit, so that the different cases
can be distinguished.

With this patch, my own name gets correctly decoded as Jan H. Schönherr
(without quotes) and not as "Jan H. Schönherr" (with quotes).

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch: make rfc2047 encoding more strict
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:32 +0000 (16:43 +0200)]
format-patch: make rfc2047 encoding more strict

RFC 2047 requires more characters to be encoded than it is currently done.
Especially, RFC 2047 distinguishes between allowed remaining characters
in encoded words in addresses (From, To, etc.) and other headers, such
as Subject.

Make add_rfc2047() and is_rfc2047_special() location dependent and include
all non-allowed characters to hopefully be RFC 2047 conformant.

This especially fixes a problem, where RFC 822 specials (e. g. ".") were
left unencoded in addresses, which was solved with a non-standard-conforming
workaround in the past (which is going to be removed in a follow-up patch).

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch: introduce helper function last_line_length()
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:31 +0000 (16:43 +0200)]
format-patch: introduce helper function last_line_length()

Currently, an open-coded loop to calculate the length of the last
line of a string buffer is used in multiple places.

Move that code into a function of its own.

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch: do not wrap rfc2047 encoded headers too late
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:30 +0000 (16:43 +0200)]
format-patch: do not wrap rfc2047 encoded headers too late

Encoded characters add more than one character at once to an encoded
header. Include all characters that are about to be added in the length
calculation for wrapping.

Additionally, RFC 2047 imposes a maximum line length of 76 characters
if that line contains an rfc2047 encoded word.

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoformat-patch: do not wrap non-rfc2047 headers too early
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:29 +0000 (16:43 +0200)]
format-patch: do not wrap non-rfc2047 headers too early

Do not wrap the second and later lines of non-rfc2047-encoded headers
substantially before the 78 character limit.

Instead of passing the remaining length of the first line as wrapping
width, use the correct maximum length and tell strbuf_add_wrapped_bytes()
how many characters of the first line are already used.

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoutf8: fix off-by-one wrapping of text
Jan H. Schönherr [Thu, 18 Oct 2012 14:43:28 +0000 (16:43 +0200)]
utf8: fix off-by-one wrapping of text

The wrapping logic in strbuf_add_wrapped_text() does currently not allow
lines that entirely fill the allowed width, instead it wraps the line one
character too early.

For example, the text "This is the sixth commit." formatted via
"%w(11,1,2)" (wrap at 11 characters, 1 char indent of first line, 2 char
indent of following lines) results in four lines: " This is", "  the",
"  sixth", "  commit." This is wrong, because "  the sixth" is exactly
11 characters long, and thus allowed.

Fix this by allowing the (width+1) character of a line to be a valid
wrapping point if it is a whitespace character.

Signed-off-by: Jan H. Schönherr <>
Signed-off-by: Junio C Hamano <>
8 years agoMerge tag 'gitgui-0.17.0' of git://
Junio C Hamano [Wed, 17 Oct 2012 22:55:46 +0000 (15:55 -0700)]
Merge tag 'gitgui-0.17.0' of git://

git-gui 0.17.0

* tag 'gitgui-0.17.0' of git://
  git-gui 0.17
  git-gui: Don't prepend the prefix if value looks like a full path
  git-gui: Detect full path when parsing arguments
  git-gui: remove .git/CHERRY_PICK_HEAD after committing
  git-gui: Fix a loose/lose mistake
  git-gui: Fix semi-working shortcuts for unstage and revert
  git-gui: de.po: translate "remote" as "extern"
  git-gui: de.po: translate "bare" as "bloß"
  git-gui: de.po: consistently add untranslated hook names within braces
  git-gui: preserve commit messages in utf-8
  git-gui: open console when using --trace on windows
  git-gui: fix a typo in po/ files
  git-gui: Use PWD if it exists on Mac OS X
  git-gui: fix git-gui crash due to uninitialized variable

8 years agogit-gui 0.17 gitgui-0.17.0
Pat Thoyts [Wed, 17 Oct 2012 20:57:29 +0000 (21:57 +0100)]
git-gui 0.17

Signed-off-by: Pat Thoyts <>
8 years agogit-gui: Don't prepend the prefix if value looks like a full path
Andrew Wong [Tue, 2 Oct 2012 16:25:15 +0000 (12:25 -0400)]
git-gui: Don't prepend the prefix if value looks like a full path

When argument parsing fails to detect a file name, "git-gui" will try to
use the previously detected "head" as the file name. We should avoid
prepending the prefix if "head" looks like a full path.

Signed-off-by: Andrew Wong <>
Signed-off-by: Pat Thoyts <>
8 years agogit-gui: Detect full path when parsing arguments
Andrew Wong [Tue, 2 Oct 2012 16:25:14 +0000 (12:25 -0400)]
git-gui: Detect full path when parsing arguments

When running "git-gui blame" from a subfolder (which means prefix is
non-empty), if we pass a full path as argument, the argument parsing
will fail to recognize the argument as a file name, because prefix is
prepended to the argument.

This patch handles that scenario by adding an additional branch that
checks the file name without using the prefix.

Signed-off-by: Andrew Wong <>
Signed-off-by: Pat Thoyts <>
8 years agoFix "git diff --stat" for interesting - but empty - file changes
Linus Torvalds [Wed, 17 Oct 2012 17:00:37 +0000 (10:00 -0700)]
Fix "git diff --stat" for interesting - but empty - file changes

The behavior of "git diff --stat" is rather odd for files that have
zero lines of changes: it will discount them entirely unless they were

Which means that the stat output will simply not show files that only
had "other" changes: they were created or deleted, or their mode was

Now, those changes do show up in the summary, but so do renames, so
the diffstat logic is inconsistent. Why does it show renames with zero
lines changed, but not mode changes or added files with zero lines

So change the logic to not check for "is_renamed", but for
"is_interesting" instead, where "interesting" is judged to be any
action but a pure data change (because a pure data change with zero
data changed really isn't worth showing, if we ever get one in our

So if you did

   chmod +x Makefile
   git diff --stat

before, it would show empty (" 0 files changed"), with this it shows

 Makefile | 0
 1 file changed, 0 insertions(+), 0 deletions(-)

which I think is a more correct diffstat (and then with "--summary" it
shows *what* the metadata change to Makefile was - this is completely
consistent with our handling of renamed files).

Side note: the old behavior was *really* odd. With no changes at all,
"git diff --stat" output was empty. With just a chmod, it said "0
files changed". No way is our legacy behavior sane.

Signed-off-by: Linus Torvalds <>
Signed-off-by: Junio C Hamano <>
8 years agoGit 1.8.0-rc3 v1.8.0-rc3
Junio C Hamano [Wed, 17 Oct 2012 17:39:44 +0000 (10:39 -0700)]
Git 1.8.0-rc3

Signed-off-by: Junio C Hamano <>