gitweb.git
cvsserver: pick up the right mode bitsJunio C Hamano Tue, 10 Sep 2013 22:33:06 +0000 (15:33 -0700)

cvsserver: pick up the right mode bits

When determining the file mode from either ls-tree or diff-tree
output, we used to grab these octal mode string (typically 100644 or
100755) and then did

$git_perms .= "r" if ( $mode & 4 );
$git_perms .= "w" if ( $mode & 2 );
$git_perms .= "x" if ( $mode & 1 );

which was already wrong, as (100644 & 4) is very different from
oct("100644") & 4. An earlier refactoring 2c3af7e7 (cvsserver:
factor out git-log parsing logic, 2012-10-13) further changed it to
pick the third octal digit (10*0*644 or 10*0*755) from the left and
then do the above conversion, which does not make sense, either.

Let's use the third digit from the last of the octal mode string to
make sure we get the executable and read bits right.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tested-by: Michael Cronenworth <mike@cchtml.com>

Merge branch 'mo/cvs-server-updates'Junio C Hamano Thu, 24 Jan 2013 05:16:38 +0000 (21:16 -0800)

Merge branch 'mo/cvs-server-updates'

Various git-cvsserver updates.

* mo/cvs-server-updates:
t9402: Use TABs for indentation
t9402: Rename check.cvsCount and check.list
t9402: Simplify git ls-tree
t9402: Add missing &&; Code style
t9402: No space after IO-redirection
t9402: Dont use test_must_fail cvs
t9402: improve check_end_tree() and check_end_full_tree()
t9402: sed -i is not portable
cvsserver Documentation: new cvs ... -r support
cvsserver: add t9402 to test branch and tag refs
cvsserver: support -r and sticky tags for most operations
cvsserver: Add version awareness to argsfromdir
cvsserver: generalize getmeta() to recognize commit refs
cvsserver: implement req_Sticky and related utilities
cvsserver: add misc commit lookup, file meta data, and file listing functions
cvsserver: define a tag name character escape mechanism
cvsserver: cleanup extra slashes in filename arguments
cvsserver: factor out git-log parsing logic

Merge branch 'jc/makefile-perl-python-path-doc'Junio C Hamano Thu, 24 Jan 2013 05:09:23 +0000 (21:09 -0800)

Merge branch 'jc/makefile-perl-python-path-doc'

* 'jc/makefile-perl-python-path-doc':
Makefile: add description on PERL/PYTHON_PATH

Merge git://ozlabs.org/~paulus/gitkJunio C Hamano Wed, 23 Jan 2013 16:35:03 +0000 (08:35 -0800)

Merge git://ozlabs.org/~paulus/gitk

* git://ozlabs.org/~paulus/gitk:
gitk: Display important heads even when there are many
gitk: Improve display of list of nearby tags and heads
gitk: Fix display of branch names on some commits
gitk: Update Swedish translation (296t)
gitk: When searching, only highlight files when in Patch mode
gitk: Fix error message when clicking on a connecting line
gitk: Fix crash when not using themed widgets
gitk: Use bindshiftfunctionkey to bind Shift-F5
gitk: Refactor code for binding modified function keys
gitk: Work around empty back and forward images when buttons are disabled
gitk: Highlight first search result immediately on incremental search
gitk: Highlight current search hit in orange
gitk: Synchronize highlighting in file view when scrolling diff

Merge branch 'jc/merge-blobs'Junio C Hamano Tue, 22 Jan 2013 18:48:20 +0000 (10:48 -0800)

Merge branch 'jc/merge-blobs'

* jc/merge-blobs:
Makefile: Replace merge-file.h with merge-blobs.h in LIB_H

Makefile: Replace merge-file.h with merge-blobs.h in... Ramsay Jones Tue, 22 Jan 2013 16:47:47 +0000 (16:47 +0000)

Makefile: Replace merge-file.h with merge-blobs.h in LIB_H

Commit fa2364ec ("Which merge_file() function do you mean?", 06-12-2012)
renamed the files merge-file.[ch] to merge-blobs.[ch], but forgot to
rename the header file in the definition of the LIB_H macro.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.2Junio C Hamano Tue, 22 Jan 2013 18:01:05 +0000 (10:01 -0800)

Update draft release notes to 1.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mz/reset-misc'Junio C Hamano Tue, 22 Jan 2013 17:36:13 +0000 (09:36 -0800)

Merge branch 'mz/reset-misc'

Various 'reset' optimizations and clean-ups, followed by a change
to allow "git reset" to work even on an unborn branch.

* mz/reset-misc:
reset: update documentation to require only tree-ish with paths
reset [--mixed]: use diff-based reset whether or not pathspec was given
reset: allow reset on unborn branch
reset $sha1 $pathspec: require $sha1 only to be treeish
reset.c: inline update_index_refresh()
reset.c: finish entire cmd_reset() whether or not pathspec is given
reset [--mixed]: only write index file once
reset.c: move lock, write and commit out of update_index_refresh()
reset.c: move update_index_refresh() call out of read_from_tree()
reset.c: replace switch by if-else
reset: avoid redundant error message
reset --keep: only write index file once
reset.c: share call to die_if_unmerged_cache()
reset.c: extract function for updating {ORIG_,}HEAD
reset.c: remove unnecessary variable 'i'
reset.c: extract function for parsing arguments
reset: don't allow "git reset -- $pathspec" in bare repo
reset.c: pass pathspec around instead of (prefix, argv) pair
reset $pathspec: exit with code 0 if successful
reset $pathspec: no need to discard index

Merge branch 'nd/fix-directory-attrs-off-by-one'Junio C Hamano Tue, 22 Jan 2013 17:34:28 +0000 (09:34 -0800)

Merge branch 'nd/fix-directory-attrs-off-by-one'

Fix performance regression introduced by an earlier change to let
attributes apply to directories.

Needs to be merged to maint, as 94bc671a was merged there already.

* nd/fix-directory-attrs-off-by-one:
attr: avoid calling find_basename() twice per path
attr: fix off-by-one directory component length calculation

Merge branch 'pw/p4-branch-fixes'Junio C Hamano Tue, 22 Jan 2013 04:15:44 +0000 (20:15 -0800)

Merge branch 'pw/p4-branch-fixes'

Fix "git p4" around branch handling.

* pw/p4-branch-fixes:
git p4: fix submit when no master branch
git p4 test: keep P4CLIENT changes inside subshells
git p4: fix sync --branch when no master branch
git p4: fail gracefully on sync with no master branch
git p4: rearrange self.initialParent use
git p4: allow short ref names to --branch
git p4 doc: fix branch detection example
git p4: clone --branch should checkout master
git p4: verify expected refs in clone --bare test
git p4: create p4/HEAD on initial clone
git p4: inline listExistingP4GitBranches
git p4: add comments to p4BranchesInGit
git p4: rearrange and simplify hasOrigin handling
git p4: test sync/clone --branch behavior

Merge branch 'mh/remote-hg-mode-bits-fix'Junio C Hamano Tue, 22 Jan 2013 04:15:40 +0000 (20:15 -0800)

Merge branch 'mh/remote-hg-mode-bits-fix'

Update to the Hg remote helper (in contrib/).

* mh/remote-hg-mode-bits-fix:
remote-hg: fix handling of file perms when pushing

Merge branch 'fc/remote-hg-fixup-url'Junio C Hamano Tue, 22 Jan 2013 04:15:32 +0000 (20:15 -0800)

Merge branch 'fc/remote-hg-fixup-url'

Update to the Hg remote helper (in contrib/).

* fc/remote-hg-fixup-url:
remote-hg: store converted URL

Merge branch 'zk/clean-report-failure'Junio C Hamano Tue, 22 Jan 2013 04:15:24 +0000 (20:15 -0800)

Merge branch 'zk/clean-report-failure'

"git clean" states what it is going to remove and then goes on to
remove it, but sometimes it only discovers things that cannot be
removed after recursing into a directory, which makes the output
confusing and even wrong.

* zk/clean-report-failure:
git-clean: Display more accurate delete messages

Merge branch 'ph/rebase-preserve-all-merges'Junio C Hamano Tue, 22 Jan 2013 04:15:15 +0000 (20:15 -0800)

Merge branch 'ph/rebase-preserve-all-merges'

An earlier change to add --keep-empty option broke "git rebase
--preserve-merges" and lost merge commits that end up being the
same as its parent.

* ph/rebase-preserve-all-merges:
rebase --preserve-merges: keep all merge commits including empty ones

Merge branch 'nd/clone-no-separate-git-dir-with-bare'Junio C Hamano Tue, 22 Jan 2013 04:15:07 +0000 (20:15 -0800)

Merge branch 'nd/clone-no-separate-git-dir-with-bare'

Forbid a useless combination of options to "git clone".

* nd/clone-no-separate-git-dir-with-bare:
clone: forbid --bare --separate-git-dir <dir>

Merge branch 'maint'Junio C Hamano Tue, 22 Jan 2013 01:16:16 +0000 (17:16 -0800)

Merge branch 'maint'

* maint:
git-for-each-ref.txt: 'raw' is a supported date format

git-for-each-ref.txt: 'raw' is a supported date formatJohn Keeping Mon, 21 Jan 2013 16:22:06 +0000 (16:22 +0000)

git-for-each-ref.txt: 'raw' is a supported date format

Commit 7dff9b3 (Support 'raw' date format) added a raw date format.
Update the git-for-each-ref documentation to include this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.2Junio C Hamano Mon, 21 Jan 2013 01:28:13 +0000 (17:28 -0800)

Update draft release notes to 1.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Mon, 21 Jan 2013 01:27:27 +0000 (17:27 -0800)

Merge branch 'maint'

Start preparing for 1.8.1.2Junio C Hamano Mon, 21 Jan 2013 01:26:04 +0000 (17:26 -0800)

Start preparing for 1.8.1.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'nz/send-email-headers-are-case-insensitiv... Junio C Hamano Mon, 21 Jan 2013 01:22:49 +0000 (17:22 -0800)

Merge branch 'nz/send-email-headers-are-case-insensitive' into maint

When users spell "cc:" in lowercase in the fake "header" in the
trailer part, "git send-email" failed to pick up the addresses from
there. As e-mail headers field names are case insensitive, this
script should follow suit and treat "cc:" and "Cc:" the same way.

* nz/send-email-headers-are-case-insensitive:
git-send-email: treat field names as case-insensitively

Merge branch 'rs/zip-with-uncompressed-size-in-the... Junio C Hamano Mon, 21 Jan 2013 01:22:27 +0000 (17:22 -0800)

Merge branch 'rs/zip-with-uncompressed-size-in-the-header' into maint

"git archive" did not record uncompressed size in the header when
streaming a zip archive, which confused some implementations of
unzip.

* rs/zip-with-uncompressed-size-in-the-header:
archive-zip: write uncompressed size into header even with streaming

Merge branch 'rs/zip-tests' into maintJunio C Hamano Mon, 21 Jan 2013 01:22:22 +0000 (17:22 -0800)

Merge branch 'rs/zip-tests' into maint

* rs/zip-tests:
t5003: check if unzip supports symlinks
t5000, t5003: move ZIP tests into their own script
t0024, t5000: use test_lazy_prereq for UNZIP
t0024, t5000: clear variable UNZIP, use GIT_UNZIP instead

Merge git://git.bogomips.org/git-svnJunio C Hamano Mon, 21 Jan 2013 01:08:46 +0000 (17:08 -0800)

Merge git://git.bogomips.org/git-svn

* git://git.bogomips.org/git-svn:
git-svn: do not escape certain characters in paths

Merge branch 'rt/commit-cleanup-config'Junio C Hamano Mon, 21 Jan 2013 01:07:04 +0000 (17:07 -0800)

Merge branch 'rt/commit-cleanup-config'

Add a configuration variable to set default clean-up mode other
than "strip".

* rt/commit-cleanup-config:
commit: make default of "cleanup" option configurable

Merge branch 'ap/log-mailmap'Junio C Hamano Mon, 21 Jan 2013 01:06:52 +0000 (17:06 -0800)

Merge branch 'ap/log-mailmap'

Teach commands in the "log" family to optionally pay attention to
the mailmap.

* ap/log-mailmap:
log --use-mailmap: optimize for cases without --author/--committer search
log: add log.mailmap configuration option
log: grep author/committer using mailmap
test: add test for --use-mailmap option
log: add --use-mailmap option
pretty: use mailmap to display username and email
mailmap: add mailmap structure to rev_info and pp
mailmap: simplify map_user() interface
mailmap: remove email copy and length limitation
Use split_ident_line to parse author and committer
string-list: allow case-insensitive string list

git-svn: do not escape certain characters in pathsPeter Wu Thu, 17 Jan 2013 22:07:31 +0000 (23:07 +0100)

git-svn: do not escape certain characters in paths

Subversion 1.7 and newer implement HTTPv2, an extension that should make HTTP
more efficient. Servers with support for this protocol will make the subversion
client library take an alternative code path that checks (with assertions)
whether the URL is "canonical" or not.

This patch fixes an issue I encountered while trying to `git svn dcommit` a
rename action for a file containing a single quote character ("User's Manual"
to "UserMan.tex"). It does not happen for older subversion 1.6 servers nor
non-HTTP(S) protocols such as the native svn protocol, only on an Apache server
shipping SVN 1.7. Trying to `git svn dcommit` under the aforementioned
conditions yields the following error which aborts the commit process:

Committing to http://example.com/svn ...
perl: subversion/libsvn_subr/dirent_uri.c:1520: uri_skip_ancestor:
Assertion `svn_uri_is_canonical(child_uri, ((void *)0))' failed.
error: git-svn died of signal 6

An analysis of the subversion source for the cause:

- The assertion originates from uri_skip_ancestor which calls
svn_uri_is_canonical, which fails when the URL contains percent-encoded values
that do not necessarily have to be encoded (not "canonical" enough). This is
done by a table lookup in libsvn_subr/path.c. Putting some debugging prints
revealed that the character ' is indeed encoded to %27 which is not
considered canonical.
- url_skip_ancestor is called by svn_ra_neon__get_baseline_info with the root
repository URL and path as parameters;
- which is called by copy_resource (libsvn_ra_neon/commit.c) for a copy action
(or in my case, renaming which is actually copy + delete old);
- which is called by commit_add_dir;
- which is assigned as a structure method "add_file" in
svn_ra_neon__get_commit_editor.

In the whole path, the path argument is not modified.

Through some more uninteresting wrapper functions, the Perl bindings gives you
access to the add_file method which will pass the path argument without
modifications to svn.

git-svn calls the "R"(ename) subroutine in Git::SVN::Editor which contains:
326 my $fbat = $self->add_file($self->repo_path($m->{file_b}), $pbat,
327 $self->url_path($m->{file_a}), $self->{r});
"repo_path" basically returns the path as-is, unless the "svn.pathnameencoding"
configuration property is set. "url_path" tries to escape some special
characters, but does not take all special characters into account, thereby
causing the path to contain some escaped characters which do not have to be
escaped.

The list of characters not to be escaped are taken from the
subversion/libsvn_subr/path.c file to fully account for all characters. Tested
with a filename containing all characters in the range 0x20 to 0x78 (inclusive).

Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

Merge git://bogomips.org/git-svnJunio C Hamano Fri, 18 Jan 2013 20:40:28 +0000 (12:40 -0800)

Merge git://bogomips.org/git-svn

* git://bogomips.org/git-svn:
git-svn: teach find-rev to find near matches
git svn: do not overescape URLs (fallback case)
Git::SVN::Editor::T: pass $deletions to ->A and ->D

Update draft release notes to 1.8.2Junio C Hamano Fri, 18 Jan 2013 19:26:11 +0000 (11:26 -0800)

Update draft release notes to 1.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'ss/help-htmlpath-config-doc'Junio C Hamano Fri, 18 Jan 2013 19:20:20 +0000 (11:20 -0800)

Merge branch 'ss/help-htmlpath-config-doc'

Add missing doc.

* ss/help-htmlpath-config-doc:
config.txt: Document help.htmlpath config parameter

Merge branch 'nd/fix-perf-parameters-in-tests'Junio C Hamano Fri, 18 Jan 2013 19:20:15 +0000 (11:20 -0800)

Merge branch 'nd/fix-perf-parameters-in-tests'

Allow GIT_PERF_* environment variables to be passed through the
test framework.

* nd/fix-perf-parameters-in-tests:
test-lib.sh: unfilter GIT_PERF_*

Merge branch 'nd/attr-debug-fix'Junio C Hamano Fri, 18 Jan 2013 19:20:11 +0000 (11:20 -0800)

Merge branch 'nd/attr-debug-fix'

Fix debugging support that was broken in earlier change.

* nd/attr-debug-fix:
attr: make it build with DEBUG_ATTR again

Merge branch 'rs/pretty-use-prefixcmp'Junio C Hamano Fri, 18 Jan 2013 19:20:08 +0000 (11:20 -0800)

Merge branch 'rs/pretty-use-prefixcmp'

* rs/pretty-use-prefixcmp:
pretty: use prefixcmp instead of memcmp on NUL-terminated strings

Merge branch 'ds/completion-silence-in-tree-path-probe'Junio C Hamano Fri, 18 Jan 2013 19:20:03 +0000 (11:20 -0800)

Merge branch 'ds/completion-silence-in-tree-path-probe'

An internal ls-tree call made by completion code only to probe if
a path exists in the tree recorded in a commit object leaked error
messages when the path is not there. It is not an error at all and
should not be shown to the end user.

* ds/completion-silence-in-tree-path-probe:
git-completion.bash: silence "not a valid object" errors

Merge branch 'jn/maint-trim-vim-contrib'Junio C Hamano Fri, 18 Jan 2013 19:19:39 +0000 (11:19 -0800)

Merge branch 'jn/maint-trim-vim-contrib'

Remove instructions for old vim support, which is better described
in the upstream vim documentation.

* jn/maint-trim-vim-contrib:
contrib/vim: simplify instructions for old vim support

Merge branch 'pe/doc-email-env-is-trumped-by-config'Junio C Hamano Fri, 18 Jan 2013 19:19:33 +0000 (11:19 -0800)

Merge branch 'pe/doc-email-env-is-trumped-by-config'

In the precedence order, the environment variable $EMAIL comes
between the built-in default (i.e. taking value by asking the
system's gethostname() etc.) and the user.email configuration
variable; the documentation implied that it is stronger than the
configuration like $GIT_COMMITTER_EMAIL is, which is wrong.

* pe/doc-email-env-is-trumped-by-config:
git-commit-tree(1): correct description of defaults

Merge branch 'mk/complete-tcsh'Junio C Hamano Fri, 18 Jan 2013 19:19:28 +0000 (11:19 -0800)

Merge branch 'mk/complete-tcsh'

Update tcsh command line completion so that an unwanted space is
not added to a single directory name.

* mk/complete-tcsh:
Prevent space after directories in tcsh completion

git-svn: teach find-rev to find near matchesJohn Keeping Thu, 17 Jan 2013 22:19:33 +0000 (22:19 +0000)

git-svn: teach find-rev to find near matches

When a single SVN repository is split into multiple Git repositories
many SVN revisions will exist in only one of the Git repositories
created. For some projects the only way to build a working artifact is
to check out corresponding versions of various repositories, with no
indication of what those are in the Git world - in the SVN world the
revision numbers are sufficient.

By adding "--before" to "git-svn find-rev" we can say "tell me what this
repository looked like when that other repository looked like this":

git svn find-rev --before \
r$(git --git-dir=/over/there.git svn find-rev HEAD)

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

git svn: do not overescape URLs (fallback case)Jonathan Nieder Sun, 14 Oct 2012 11:45:21 +0000 (04:45 -0700)

git svn: do not overescape URLs (fallback case)

Subversion's canonical URLs are intended to make URL comparison easy
and therefore have strict rules about what characters are special
enough to urlencode and what characters should be left alone.

When in the fallback codepath because unable to use libsvn's own
canonicalization function for some reason, escape special characters
in URIs according to the svn_uri__char_validity[] table in
subversion/libsvn_subr/path.c (r935829). The libsvn versions that
trigger this code path are not likely to be strict enough to care, but
it's nicer to be consistent.

Noticed by using SVN 1.6.17 perl bindings, which do not provide
SVN::_Core::svn_uri_canonicalize (triggering the fallback code),
with libsvn 1.7.5, whose do_switch is fussy enough to care:

Committing to file:///home/jrn/src/git/t/trash%20directory.\
t9118-git-svn-funky-branch-names/svnrepo/pr%20ject/branches\
/more%20fun%20plugin%21 ...
svn: E235000: In file '[...]/subversion/libsvn_subr/dirent_uri.c' \
line 2291: assertion failed (svn_uri_is_canonical(url, pool))
error: git-svn died of signal 6
not ok - 3 test dcommit to funky branch

After this change, the '!' in 'more%20fun%20plugin!' is not urlencoded
and t9118 passes again.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

Git::SVN::Editor::T: pass $deletions to ->A and ->DJonathan Nieder Wed, 10 Oct 2012 21:02:18 +0000 (14:02 -0700)

Git::SVN::Editor::T: pass $deletions to ->A and ->D

This shouldn't make a difference because the $deletions hash is
only used when adding a directory (see 379862ec, 2012-02-20) but
it's nice to be consistent to make reading smoother anyway. No
functional change intended.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>

reset: update documentation to require only tree-ish... Martin von Zweigbergk Wed, 16 Jan 2013 18:00:35 +0000 (10:00 -0800)

reset: update documentation to require only tree-ish with paths

When resetting with paths, we no longer require a commit argument, but
only a tree-ish. Update the documentation and synopsis accordingly.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr: avoid calling find_basename() twice per pathDuy Nguyen Wed, 16 Jan 2013 06:02:38 +0000 (13:02 +0700)

attr: avoid calling find_basename() twice per path

find_basename() is only used inside collect_all_attrs(), called once
in prepare_attr_stack, then again after prepare_attr_stack()
returns. Both calls return exact same value. Reorder the code to do
the same task once. Also avoid strlen() because we knows the length
after finding basename.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.txt: Document help.htmlpath config parameterSebastian Staudt Tue, 15 Jan 2013 20:56:21 +0000 (21:56 +0100)

config.txt: Document help.htmlpath config parameter

Signed-off-by: Sebastian Staudt <koraktor@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib.sh: unfilter GIT_PERF_*Nguyễn Thái Ngọc Duy Tue, 15 Jan 2013 13:50:56 +0000 (20:50 +0700)

test-lib.sh: unfilter GIT_PERF_*

These variables are user parameters to control how to run the perf
tests. Allow users to do so.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr: make it build with DEBUG_ATTR againNguyễn Thái Ngọc Duy Tue, 15 Jan 2013 02:49:26 +0000 (09:49 +0700)

attr: make it build with DEBUG_ATTR again

Commit 82dce99 (attr: more matching optimizations from .gitignore -
2012-10-15) changed match_attr structure but it did not update
DEBUG_ATTR-specific code. This fixes it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-hg: fix handling of file perms when pushingMax Horn Tue, 15 Jan 2013 13:02:39 +0000 (14:02 +0100)

remote-hg: fix handling of file perms when pushing

Previously, when changing and committing an executable file, the file
would loose its executable bit on the hg side. Likewise, symlinks ended
up as "normal" files". This was not immediately apparent on the git side
unless one did a fresh clone.

Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote-hg: store converted URLFelipe Contreras Wed, 9 Jan 2013 19:43:38 +0000 (20:43 +0100)

remote-hg: store converted URL

Mercurial might convert the URL to something more appropriate, like an
absolute path. Lets store that instead of the original URL, which won't
work from a different working directory if it's relative.

Suggested-by: Max Horn <max@quendi.de>
Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: fix submit when no master branchPete Wyckoff Tue, 15 Jan 2013 00:47:08 +0000 (19:47 -0500)

git p4: fix submit when no master branch

It finds its upstream and applies the commit properly, but
the sync step will fail unless it is told which branch to
work on.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4 test: keep P4CLIENT changes inside subshellsPete Wyckoff Tue, 15 Jan 2013 00:47:07 +0000 (19:47 -0500)

git p4 test: keep P4CLIENT changes inside subshells

Tests assume that this is set to something valid. Make sure
that the 'clone --use-client-spec' does not leak its changes
out into the rest of the tests.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: fix sync --branch when no master branchPete Wyckoff Tue, 15 Jan 2013 00:47:06 +0000 (19:47 -0500)

git p4: fix sync --branch when no master branch

It is legal to sync a branch with a different name than
refs/remotes/p4/master, and to do so even when master does
not exist.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: fail gracefully on sync with no master branchPete Wyckoff Tue, 15 Jan 2013 00:47:05 +0000 (19:47 -0500)

git p4: fail gracefully on sync with no master branch

If --branch was used to build a repository with no
refs/remotes/p4/master, future syncs will not know
which branch to sync. Notice this situation and
print a helpful error message.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: rearrange self.initialParent usePete Wyckoff Tue, 15 Jan 2013 00:47:04 +0000 (19:47 -0500)

git p4: rearrange self.initialParent use

This was set in a couple of places, both of which were very
far away from its use. Move it a bit closer to importChanges(),
and add some comments.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: allow short ref names to --branchPete Wyckoff Tue, 15 Jan 2013 00:47:03 +0000 (19:47 -0500)

git p4: allow short ref names to --branch

For a clone or sync, --branch says where the newly imported
branch should go, or which existing branch to sync up. It
takes an argument, which is currently either something that
starts with "refs/", or if not, "refs/heads/p4" is prepended.

Putting it in heads seems like a bad default; these should
go in remotes/p4/ in most situations. Make that the new default,
and be more liberal in the form of the branch name.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4 doc: fix branch detection examplePete Wyckoff Tue, 15 Jan 2013 00:47:02 +0000 (19:47 -0500)

git p4 doc: fix branch detection example

Make sure that the example on how to use git-p4.branchList
works if typed directly. In particular, it does not make sense
to set a config variable until the git repository has been
initialized.

Reported-by: Olivier Delalleau <shish@keba.be>
Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: clone --branch should checkout masterPete Wyckoff Tue, 15 Jan 2013 00:47:01 +0000 (19:47 -0500)

git p4: clone --branch should checkout master

When using the --branch argument to "git p4 clone", one
might specify a destination for p4 changes different from
the default refs/remotes/p4/master. Both cases should
create a master branch and checkout files.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: verify expected refs in clone --bare testPete Wyckoff Tue, 15 Jan 2013 00:47:00 +0000 (19:47 -0500)

git p4: verify expected refs in clone --bare test

Make sure that the standard branches are created as expected.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: create p4/HEAD on initial clonePete Wyckoff Tue, 15 Jan 2013 00:46:59 +0000 (19:46 -0500)

git p4: create p4/HEAD on initial clone

There is code to create a symbolic reference from p4/HEAD to
p4/master. This allows saying "git show p4" as a shortcut
to "git show p4/master", for example.

But this reference was only created on the second "git p4 sync"
(or first sync after a clone). Make it work on the initial
clone or sync.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: inline listExistingP4GitBranchesPete Wyckoff Tue, 15 Jan 2013 00:46:58 +0000 (19:46 -0500)

git p4: inline listExistingP4GitBranches

It is four lines of code used in only one place. Simplify by
including it where it is used.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: add comments to p4BranchesInGitPete Wyckoff Tue, 15 Jan 2013 00:46:57 +0000 (19:46 -0500)

git p4: add comments to p4BranchesInGit

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: rearrange and simplify hasOrigin handlingPete Wyckoff Tue, 15 Jan 2013 00:46:56 +0000 (19:46 -0500)

git p4: rearrange and simplify hasOrigin handling

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git p4: test sync/clone --branch behaviorPete Wyckoff Tue, 15 Jan 2013 00:46:55 +0000 (19:46 -0500)

git p4: test sync/clone --branch behavior

Add failing tests to document behavior when there are multiple p4
branches, as created using the --branch option. In particular:

Using clone --branch populates the specified branch correctly, but
dies with an error when trying to checkout master.

Calling sync without a master branch dies with an error looking for
master. When there are two or more branches, a sync does
nothing due to branch detection code, but that is expected.

Using sync --branch to try to update just a particular branch
updates no branch, but appears to succeed.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset [--mixed]: use diff-based reset whether or not... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:51 +0000 (21:47 -0800)

reset [--mixed]: use diff-based reset whether or not pathspec was given

Thanks to b65982b (Optimize "diff-index --cached" using cache-tree,
2009-05-20), resetting with paths is much faster than resetting
without paths. Some timings for the linux-2.6 repo to illustrate this
(best of five, warm cache):

reset reset .
real 0m0.219s 0m0.080s
user 0m0.140s 0m0.040s
sys 0m0.070s 0m0.030s

These two commands should do the same thing, so instead of having the
user type the trailing " ." to get the faster do_diff_cache()-based
implementation, always use it when doing a mixed reset, with or
without paths (so "git reset $rev" would also be faster).

Timing "git reset" shows that it indeed becomes as fast as
"git reset ." after this patch.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: allow reset on unborn branchMartin von Zweigbergk Tue, 15 Jan 2013 05:47:50 +0000 (21:47 -0800)

reset: allow reset on unborn branch

Some users seem to think, knowingly or not, that being on an unborn
branch is like having a commit with an empty tree checked out, but
when run on an unborn branch, "git reset" currently fails with:

fatal: Failed to resolve 'HEAD' as a valid ref.

Instead of making users figure out that they should run

git rm --cached -r .

, let's teach "git reset" without a revision argument, when on an
unborn branch, to behave as if the user asked to reset to an empty
tree. Don't take the analogy with an empty commit too far, though, but
still disallow explictly referring to HEAD in "git reset HEAD".

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset $sha1 $pathspec: require $sha1 only to be treeishMartin von Zweigbergk Tue, 15 Jan 2013 05:47:49 +0000 (21:47 -0800)

reset $sha1 $pathspec: require $sha1 only to be treeish

Resetting with paths does not update HEAD and there is nothing else
that a commit should be needed for. Relax the argument parsing so only
a tree is required.

The sha1 is only passed to read_from_tree(), which already only
requires a tree.

The "rev" variable we pass to run_add_interactive() will resolve to a
tree. This is fine since interactive_reset only needs the parameter to
be a treeish and doesn't use it for display purposes.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: inline update_index_refresh()Martin von Zweigbergk Tue, 15 Jan 2013 05:47:48 +0000 (21:47 -0800)

reset.c: inline update_index_refresh()

Now that there is only one caller left to the single-line method
update_index_refresh(), inline it.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: finish entire cmd_reset() whether or not paths... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:47 +0000 (21:47 -0800)

reset.c: finish entire cmd_reset() whether or not pathspec is given

By not returning from inside the "if (pathspec)" block, we can let the
pathspec-aware and pathspec-less code share a bit more, making it
easier to make future changes that should affect both cases. This also
highlights the similarity between read_from_tree() and reset_index().

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset [--mixed]: only write index file onceMartin von Zweigbergk Tue, 15 Jan 2013 05:47:46 +0000 (21:47 -0800)

reset [--mixed]: only write index file once

When doing a mixed reset without paths, the index is locked, read,
reset, and written back as part of the actual reset operation (in
reset_index()). Then, when showing the list of worktree modifications,
we lock the index again, refresh it, and write it.

Change this so we only write the index once, making "git reset" a
little faster. It does mean that the index lock will be held a little
longer, but the difference is small compared to the time spent
refreshing the index.

There is one minor functional difference: We used to say "Could not
write new index file." if the first write failed, and "Could not
refresh index" if the second write failed. Now, we will only use the
first message.

This speeds up "git reset" a little on the linux-2.6 repo (best of
five, warm cache):

Before After
real 0m0.239s 0m0.214s
user 0m0.160s 0m0.130s
sys 0m0.070s 0m0.080s

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: move lock, write and commit out of update_inde... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:45 +0000 (21:47 -0800)

reset.c: move lock, write and commit out of update_index_refresh()

In preparation for the/a following patch, move the locking, writing
and committing of the index file out of update_index_refresh(). The
code duplication caused will soon be taken care of. What remains of
update_index_refresh() is just one line, but it is still called from
two places, so let's leave it for now.

In the process, we expose and fix the minor UI bug that makes us print
"Could not refresh index" when we fail to write the index file when
invoked with a pathspec. Copy the error message from the pathspec-less
codepath ("Could not write new index file.").

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: move update_index_refresh() call out of read_f... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:44 +0000 (21:47 -0800)

reset.c: move update_index_refresh() call out of read_from_tree()

The final part of cmd_reset() essentially looks like:

if (pathspec) {
...
read_from_tree(...);
} else {
...
reset_index(...);
update_index_refresh(...);
...
}

where read_from_tree() internally also calls
update_index_refresh(). Move the call to update_index_refresh() out of
read_from_tree for symmetry with the 'else' block, making
read_from_tree() and reset_index() closer in functionality.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: replace switch by if-elseMartin von Zweigbergk Tue, 15 Jan 2013 05:47:43 +0000 (21:47 -0800)

reset.c: replace switch by if-else

The switch statement towards the end of reset.c is missing case arms
for KEEP and MERGE for no obvious reason, and soon the only non-empty
case arm will be the one for HARD. So let's proactively replace it by
if-else, which will let us move one if statement out without leaving
funny-looking left-overs.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: avoid redundant error messageMartin von Zweigbergk Tue, 15 Jan 2013 05:47:42 +0000 (21:47 -0800)

reset: avoid redundant error message

If writing or committing the new index file fails, we print "Could not
write new index file." followed by "Could not reset index file to
revision $rev.". The first message seems to imply the second, so print
only the first message.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset --keep: only write index file onceMartin von Zweigbergk Tue, 15 Jan 2013 05:47:41 +0000 (21:47 -0800)

reset --keep: only write index file once

"git reset --keep" calls reset_index_file() twice, first doing a
two-way merge to the target revision, updating the index and worktree,
and then resetting the index. After each call, we write the index
file.

In the unlikely event that the second call to reset_index_file()
fails, the index will have been merged to the target revision, but
HEAD will not be updated, leaving the user with a dirty index.

By moving the locking, writing and committing out of
reset_index_file() and into the caller, we can avoid writing the index
twice, thereby making the sure we don't end up in the half-way reset
state. As a bonus, we speed up "git reset --keep" a little on the
linux-2.6 repo (best of five, warm cache):

Before After
real 0m0.315s 0m0.296s
user 0m0.290s 0m0.280s
sys 0m0.020s 0m0.010s

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: share call to die_if_unmerged_cache()Martin von Zweigbergk Tue, 15 Jan 2013 05:47:40 +0000 (21:47 -0800)

reset.c: share call to die_if_unmerged_cache()

Use a single condition to guard the call to die_if_unmerged_cache for
both --soft and --keep. This avoids the small distraction of the
precondition check from the logic following it.

Also change an instance of

if (e)
err = err || f();

to the almost as short, but clearer

if (e && !err)
err = f();

(which is equivalent since we only care whether exit code is 0)

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: extract function for updating {ORIG_,}HEADMartin von Zweigbergk Tue, 15 Jan 2013 05:47:39 +0000 (21:47 -0800)

reset.c: extract function for updating {ORIG_,}HEAD

By extracting the code for updating the HEAD and ORIG_HEAD symbolic
references to a separate function, we declutter cmd_reset() a bit and
we make it clear that e.g. the four variables {,sha1_}{,old_}orig are
only used by this code.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: remove unnecessary variable 'i'Martin von Zweigbergk Tue, 15 Jan 2013 05:47:38 +0000 (21:47 -0800)

reset.c: remove unnecessary variable 'i'

Throughout most of parse_args(), the variable 'i' remains at 0. Many
references are still made to the variable even when it could only have
the value 0. This made at least me, who has relatively little
experience with C programming styles, think that parts of the function
was meant to be part of a loop. To avoid such confusion, remove the
variable and also the 'argc' parameter and check for NULL trailing
argv instead.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: extract function for parsing argumentsMartin von Zweigbergk Tue, 15 Jan 2013 05:47:37 +0000 (21:47 -0800)

reset.c: extract function for parsing arguments

Declutter cmd_reset() a bit by moving out the argument parsing to its
own function.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset: don't allow "git reset -- $pathspec" in bare... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:36 +0000 (21:47 -0800)

reset: don't allow "git reset -- $pathspec" in bare repo

Running e.g. "git reset ." in a bare repo results in an index file
being created from the HEAD commit. The differences compared to the
index are then printed as usual, but since there is no worktree, it
will appear as if all files are deleted. For example, in a bare clone
of git.git:

Unstaged changes after reset:
D .gitattributes
D .gitignore
D .mailmap
...

This happens because the check for is_bare_repository() happens after
we branch off into read_from_tree() to reset with paths. Fix by moving
the branching point after the check.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset.c: pass pathspec around instead of (prefix, argv... Martin von Zweigbergk Tue, 15 Jan 2013 05:47:35 +0000 (21:47 -0800)

reset.c: pass pathspec around instead of (prefix, argv) pair

We use the path arguments in two places in reset.c: in
interactive_reset() and read_from_tree(). Both of these call
get_pathspec(), so we pass the (prefix, argv) pair to both
functions. Move the call to get_pathspec() out of these methods, for
two reasons: 1) One argument is simpler than two. 2) It lets us use
the (arguably clearer) "if (pathspec)" in place of "if (i < argc)".

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset $pathspec: exit with code 0 if successfulMartin von Zweigbergk Tue, 15 Jan 2013 05:47:34 +0000 (21:47 -0800)

reset $pathspec: exit with code 0 if successful

"git reset $pathspec" currently exits with a non-zero exit code if the
worktree is dirty after resetting, which is inconsistent with reset
without pathspec, and it makes it harder to know whether the command
really failed. Change it to exit with code 0 regardless of whether the
worktree is dirty so that non-zero indicates an error.

This makes the 4 "disambiguation" test cases in t7102 clearer since
they all used to "fail", 3 of which "failed" due to changes in the
work tree. Now only the ambiguous one fails.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

reset $pathspec: no need to discard indexMartin von Zweigbergk Tue, 15 Jan 2013 05:47:33 +0000 (21:47 -0800)

reset $pathspec: no need to discard index

Since 34110cd (Make 'unpack_trees()' have a separate source and
destination index, 2008-03-06), the index no longer gets clobbered by
do_diff_cache() and we can remove the code for discarding and
re-reading it.

There are two paths to update_index_refresh() from cmd_reset(), but on
both paths, either read_cache() or read_cache_unmerged() will have
been called, so the call to read_cache() in this method is redundant
(although practically free).

This speeds up "git reset -- ." a little on the linux-2.6 repo (best
of five, warm cache):

Before After
real 0m0.093s 0m0.080s
user 0m0.040s 0m0.020s
sys 0m0.050s 0m0.050s

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr: fix off-by-one directory component length calculationNguyễn Thái Ngọc Duy Tue, 15 Jan 2013 13:35:24 +0000 (20:35 +0700)

attr: fix off-by-one directory component length calculation

94bc671 (Add directory pattern matching to attributes - 2012-12-08)
uses find_basename() to calculate the length of directory part in
prepare_attr_stack. This function expects the directory without the
trailing slash (as "origin" field in match_attr struct is without the
trailing slash). find_basename() includes the trailing slash and
confuses push/pop algorithm.

Consider path = "abc/def" and the push down code:

while (1) {
len = strlen(attr_stack->origin);
if (dirlen <= len)
break;
cp = memchr(path + len + 1, '/', dirlen - len - 1);
if (!cp)
cp = path + dirlen;

dirlen is 4, not 3, without this patch. So when attr_stack->origin is
"abc", it'll miss the exit condition because 4 <= 3 is wrong. It'll
then try to push "abc/" down the attr stack (because "cp" would be
NULL). So we have both "abc" and "abc/" in the stack.

Next time when "abc/ghi" is checked, "abc/" is popped out because of
the off-by-one dirlen, only to be pushed back in again by the above
code. This repeats for all files in the same directory. Which means
at least one failed open syscall per file, or more if .gitattributes
exists.

This is the perf result with 10 runs on git.git:

Test 94bc671^ 94bc671 HEAD
----------------------------------------------------------------------------------------------------------
7810.1: grep worktree, cheap regex 0.02(0.01+0.04) 0.05(0.03+0.05) +150.0% 0.02(0.01+0.04) +0.0%
7810.2: grep worktree, expensive regex 0.25(0.94+0.01) 0.26(0.94+0.02) +4.0% 0.25(0.93+0.02) +0.0%
7810.3: grep --cached, cheap regex 0.11(0.10+0.00) 0.12(0.10+0.02) +9.1% 0.10(0.10+0.00) -9.1%
7810.4: grep --cached, expensive regex 0.61(0.60+0.01) 0.62(0.61+0.01) +1.6% 0.61(0.60+0.00) +0.0%

Reported-by: Ross Lagerwall <rosslagerwall@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: use prefixcmp instead of memcmp on NUL-terminat... René Scharfe Mon, 14 Jan 2013 16:34:56 +0000 (17:34 +0100)

pretty: use prefixcmp instead of memcmp on NUL-terminated strings

This conversion avoids the need for magic string length numbers in the
code. And unlike memcmp(), prefixcmp() is careful to not run over the
end of a string.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase --preserve-merges: keep all merge commits includ... Phil Hord Sat, 12 Jan 2013 20:46:01 +0000 (15:46 -0500)

rebase --preserve-merges: keep all merge commits including empty ones

Since 90e1818f9a (git-rebase: add keep_empty flag, 2012-04-20)
'git rebase --preserve-merges' fails to preserve empty merge commits
unless --keep-empty is also specified. Merge commits should be
preserved in order to preserve the structure of the rebased graph,
even if the merge commit does not introduce changes to the parent.

Teach rebase not to drop merge commits only because they are empty.

A special case which is not handled by this change is for a merge commit
whose parents are now the same commit because all the previous different
parents have been dropped as a result of this rebase or some previous
operation.

Signed-off-by: Phil Hord <hordp@cisco.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-clean: Display more accurate delete messagesZoltan Klinger Thu, 10 Jan 2013 22:53:46 +0000 (09:53 +1100)

git-clean: Display more accurate delete messages

(1) Only print out the names of the files and directories that got
actually deleted. Also do not mention that we are not removing
directories when the user did not ask us to do so with '-d'.
(2) Show ignore message for skipped untracked git repositories.

Consider the following repo layout:

test.git/
|-- tracked_dir/
| |-- some_tracked_file
| |-- some_untracked_file
|-- tracked_file
|-- untracked_file
|-- untracked_foo/
| |-- bar/
| | |-- bar.txt
| |-- emptydir/
| |-- frotz.git/
| |-- frotz.tx
|-- untracked_some.git/
|-- some.txt

Suppose the user issues 'git clean -fd' from the test.git directory.

When -d option is used and untracked directory 'foo' contains a
subdirectory 'frotz.git' that is managed by a different git repository
therefore it will not be removed.

$ git clean -fd
Removing tracked_dir/some_untracked_file
Removing untracked_file
Removing untracked_foo/
Removing untracked_some.git/

The message displayed to the user is slightly misleading. The foo/
directory has not been removed because of foo/frotz.git still exists.
On the other hand the subdirectories 'bar' and 'emptydir' have been
deleted but they're not mentioned anywhere. Also, untracked_some.git
has not been removed either.

This behaviour is the result of the way the deletion of untracked
directories are reported. In the current implementation they are
deleted recursively but only the name of the top most directory is
printed out. The calling function does not know about any
subdirectories that could not be removed during the recursion.

Improve the way the deleted directories are reported back to
the user:
(1) Create a recursive delete function 'remove_dirs' in builtin/clean.c
to run in both dry_run and delete modes with the delete logic as
follows:
(a) Check if the current directory to be deleted is an untracked
git repository. If it is and --force --force option is not set
do not touch this directory, print ignore message, set dir_gone
flag to false for the caller and return.
(b) Otherwise for each item in current directory:
(i) If current directory cannot be accessed, print warning,
set dir_gone flag to false and return.
(ii) If the item is a subdirectory recurse into it,
check for the returned value of the dir_gone flag.
If the subdirectory is gone, add the name of the deleted
directory to a list of successfully removed items 'dels'.
Else set the dir_gone flag as the current directory
cannot be removed because we have at least one subdirectory
hanging around.
(iii) If it is a file try to remove it. If success add the
file name to the 'dels' list, else print error and set
dir_gone flag to false.
(c) After we finished deleting all items in the current directory and
the dir_gone flag is still true, remove the directory itself.
If failed set the dir_gone flag to false.

(d) If the current directory cannot be deleted because the dir_gone flag
has been set to false, print out all the successfully deleted items
for this directory from the 'dels' list.
(e) We're done with the current directory, return.

(2) Modify the cmd_clean() function to:
(a) call the recursive delete function 'remove_dirs()' for each
topmost directory it wants to remove
(b) check for the returned value of dir_gone flag. If it's true
print the name of the directory as being removed.

Consider the output of the improved version:

$ git clean -fd
Removing tracked_dir/some_untracked_file
Removing untracked_file
Skipping repository untracked_foo/frotz.git
Removing untracked_foo/bar
Removing untracked_foo/emptydir
Skipping repository untracked_some.git/

Now it displays only the file and directory names that got actually
deleted and shows the name of the untracked git repositories it ignored.

Reported-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Zoltan Klinger <zoltan.klinger@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with 1.8.1.1Junio C Hamano Mon, 14 Jan 2013 16:22:27 +0000 (08:22 -0800)

Sync with 1.8.1.1

Update draft release notes to 1.8.2Junio C Hamano Mon, 14 Jan 2013 16:21:35 +0000 (08:21 -0800)

Update draft release notes to 1.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/blame-no-follow'Junio C Hamano Mon, 14 Jan 2013 16:15:51 +0000 (08:15 -0800)

Merge branch 'jc/blame-no-follow'

Teaches "--no-follow" option to "git blame" to disable its
whole-file rename detection.

* jc/blame-no-follow:
blame: pay attention to --no-follow
diff: accept --no-follow option

Merge branch 'fc/remote-testgit-feature-done'Junio C Hamano Mon, 14 Jan 2013 16:15:46 +0000 (08:15 -0800)

Merge branch 'fc/remote-testgit-feature-done'

In the longer term, tightening rules is a good thing to do, and
because nobody who has worked in the remote helper area seems to be
interested in reviewing this, I would assume they do not think
such a retroactive tightening will affect their remote helpers. So
let's advance this topic to see what happens.

* fc/remote-testgit-feature-done:
remote-testgit: properly check for errors

Merge branch 'nd/upload-pack-shallow-must-be-commit'Junio C Hamano Mon, 14 Jan 2013 16:15:44 +0000 (08:15 -0800)

Merge branch 'nd/upload-pack-shallow-must-be-commit'

A minor consistency check patch that does not have much relevance
to the real world.

* nd/upload-pack-shallow-must-be-commit:
upload-pack: only accept commits from "shallow" line

Merge branch 'ap/status-ignored-in-ignored-directory'Junio C Hamano Mon, 14 Jan 2013 16:15:40 +0000 (08:15 -0800)

Merge branch 'ap/status-ignored-in-ignored-directory'

Output from "git status --ignored" showed an unexpected interaction
with "--untracked".

* ap/status-ignored-in-ignored-directory:
status: always report ignored tracked directories
git-status: Test --ignored behavior
dir.c: Make git-status --ignored more consistent

Merge branch 'nz/send-email-headers-are-case-insensitive'Junio C Hamano Mon, 14 Jan 2013 16:15:36 +0000 (08:15 -0800)

Merge branch 'nz/send-email-headers-are-case-insensitive'

When user spells "cc:" in lowercase in the fake "header" in the
trailer part, send-email failed to pick up the addresses from
there. As e-mail headers field names are case insensitive, this
script should follow suit and treat "cc:" and "Cc:" the same way.

* nz/send-email-headers-are-case-insensitive:
git-send-email: treat field names as case-insensitively

Git 1.8.1.1 v1.8.1.1Junio C Hamano Mon, 14 Jan 2013 16:04:50 +0000 (08:04 -0800)

Git 1.8.1.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jk/complete-commit-c' into maintJunio C Hamano Mon, 14 Jan 2013 16:02:35 +0000 (08:02 -0800)

Merge branch 'jk/complete-commit-c' into maint

* jk/complete-commit-c:
completion: complete refs for "git commit -c"

Merge branch 'jk/unify-exit-code-by-receiving-signal... Junio C Hamano Mon, 14 Jan 2013 16:01:27 +0000 (08:01 -0800)

Merge branch 'jk/unify-exit-code-by-receiving-signal' into maint

* jk/unify-exit-code-by-receiving-signal:
run-command: encode signal death as a positive integer

Merge branch 'jn/xml-depends-on-asciidoc-conf' into... Junio C Hamano Mon, 14 Jan 2013 16:01:00 +0000 (08:01 -0800)

Merge branch 'jn/xml-depends-on-asciidoc-conf' into maint

* jn/xml-depends-on-asciidoc-conf:
docs: manpage XML depends on asciidoc.conf

Merge branch 'jk/maint-fast-import-doc-reorder' into... Junio C Hamano Mon, 14 Jan 2013 15:59:46 +0000 (07:59 -0800)

Merge branch 'jk/maint-fast-import-doc-reorder' into maint

* jk/maint-fast-import-doc-reorder:
git-fast-import(1): reorganise options
git-fast-import(1): combine documentation of --[no-]relative-marks

Merge branch 'jk/shortlog-no-wrap-doc' into maintJunio C Hamano Mon, 14 Jan 2013 15:59:03 +0000 (07:59 -0800)

Merge branch 'jk/shortlog-no-wrap-doc' into maint

* jk/shortlog-no-wrap-doc:
git-shortlog(1): document behaviour of zero-width wrap

Merge branch 'jk/maint-fast-import-doc-dedup-done'... Junio C Hamano Mon, 14 Jan 2013 15:48:39 +0000 (07:48 -0800)

Merge branch 'jk/maint-fast-import-doc-dedup-done' into maint

* jk/maint-fast-import-doc-dedup-done:
git-fast-import(1): remove duplicate '--done' option

Merge branch 'jc/comment-cygwin-win32api-in-makefile... Junio C Hamano Mon, 14 Jan 2013 15:34:37 +0000 (07:34 -0800)

Merge branch 'jc/comment-cygwin-win32api-in-makefile' into maint

* jc/comment-cygwin-win32api-in-makefile:
Makefile: add comment on CYGWIN_V15_WIN32API

Merge branch 'rs/leave-base-name-in-name-field-of-tar... Junio C Hamano Mon, 14 Jan 2013 15:34:12 +0000 (07:34 -0800)

Merge branch 'rs/leave-base-name-in-name-field-of-tar' into maint

A tar archive created by "git archive" recorded a directory in a
way that made NetBSD's implementation of "tar" sometimes unhappy.

* rs/leave-base-name-in-name-field-of-tar:
archive-tar: split long paths more carefully