git
11 years agoMerge branch 'nd/edit-branch-desc-while-detached' into HEAD
Junio C Hamano [Wed, 30 Jan 2013 17:01:41 +0000 (09:01 -0800)] 
Merge branch 'nd/edit-branch-desc-while-detached' into HEAD

* nd/edit-branch-desc-while-detached:
  branch: no detached HEAD check when editing another branch's description

11 years agobranch: give a more helpful message on redundant arguments
Nguyễn Thái Ngọc Duy [Mon, 28 Jan 2013 01:18:15 +0000 (08:18 +0700)] 
branch: give a more helpful message on redundant arguments

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: reject -D/-d without branch name
Nguyễn Thái Ngọc Duy [Mon, 28 Jan 2013 01:18:14 +0000 (08:18 +0700)] 
branch: reject -D/-d without branch name

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agobranch: no detached HEAD check when editing another branch's description
Nguyễn Thái Ngọc Duy [Mon, 28 Jan 2013 01:18:13 +0000 (08:18 +0700)] 
branch: no detached HEAD check when editing another branch's description

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'for-junio' of git://bogomips.org/git-svn
Junio C Hamano [Fri, 25 Jan 2013 20:53:31 +0000 (12:53 -0800)] 
Merge branch 'for-junio' of git://bogomips.org/git-svn

* 'for-junio' of git://bogomips.org/git-svn:
  git-svn: Simplify calculation of GIT_DIR
  git-svn: cleanup sprintf usage for uppercasing hex

11 years agoUpdate draft release notes to 1.8.2
Junio C Hamano [Fri, 25 Jan 2013 20:52:55 +0000 (12:52 -0800)] 
Update draft release notes to 1.8.2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'nd/retire-fnmatch'
Junio C Hamano [Fri, 25 Jan 2013 20:34:55 +0000 (12:34 -0800)] 
Merge branch 'nd/retire-fnmatch'

Replace our use of fnmatch(3) with a more feature-rich wildmatch.
A handful patches at the bottom have been moved to nd/wildmatch to
graduate as part of that branch, before this series solidifies.

We may want to mark USE_WILDMATCH as an experimental curiosity a
bit more clearly (i.e. should not be enabled in production
environment, because it will make the behaviour between builds
unpredictable).

* nd/retire-fnmatch:
  Makefile: add USE_WILDMATCH to use wildmatch as fnmatch
  wildmatch: advance faster in <asterisk> + <literal> patterns
  wildmatch: make a special case for "*/" with FNM_PATHNAME
  test-wildmatch: add "perf" command to compare wildmatch and fnmatch
  wildmatch: support "no FNM_PATHNAME" mode
  wildmatch: make dowild() take arbitrary flags
  wildmatch: rename constants and update prototype

11 years agoMerge branch 'jc/doc-maintainer'
Junio C Hamano [Fri, 25 Jan 2013 20:34:52 +0000 (12:34 -0800)] 
Merge branch 'jc/doc-maintainer'

Describe tools for automation that were invented since this
document was originally written.

* jc/doc-maintainer:
  howto/maintain: document "### match next" convention in jch/pu branch
  howto/maintain: mark titles for asciidoc
  Documentation: update "howto maintain git"

11 years agohowto/maintain: document "### match next" convention in jch/pu branch
Junio C Hamano [Fri, 25 Jan 2013 20:33:57 +0000 (12:33 -0800)] 
howto/maintain: document "### match next" convention in jch/pu branch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-svn: Simplify calculation of GIT_DIR
Barry Wardell [Mon, 21 Jan 2013 01:22:02 +0000 (01:22 +0000)] 
git-svn: Simplify calculation of GIT_DIR

Since git-rev-parse already checks for the $GIT_DIR environment
variable and that it returns an actual git repository, there is no
need to repeat the checks again here.

This also fixes a problem where git-svn did not work in cases where
.git was a file with a gitdir: link.

[ew: squashed test case,
 delay setting GIT_DIR until after `git rev-parse --cdup` to fix t9101,
 (thanks to Junio)]

Signed-off-by: Barry Wardell <barry.wardell@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
11 years agogit-svn: cleanup sprintf usage for uppercasing hex
Eric Wong [Thu, 24 Jan 2013 00:23:44 +0000 (00:23 +0000)] 
git-svn: cleanup sprintf usage for uppercasing hex

We do not need to call uc() separately for sprintf("%x")
as sprintf("%X") is available.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
11 years agoMerge branch 'as/pre-push-hook'
Junio C Hamano [Thu, 24 Jan 2013 05:19:25 +0000 (21:19 -0800)] 
Merge branch 'as/pre-push-hook'

Add an extra hook so that "git push" that is run without making
sure what is being pushed is sane can be checked and rejected (as
opposed to the user deciding not pushing).

* as/pre-push-hook:
  Add sample pre-push hook script
  push: Add support for pre-push hooks
  hooks: Add function to check if a hook exists

11 years agoMerge branch 'ch/add-auto-submitted-in-sample-post-receive-email'
Junio C Hamano [Thu, 24 Jan 2013 05:19:19 +0000 (21:19 -0800)] 
Merge branch 'ch/add-auto-submitted-in-sample-post-receive-email'

* ch/add-auto-submitted-in-sample-post-receive-email:
  Add Auto-Submitted header to post-receive-email

11 years agoMerge branch 'as/check-ignore'
Junio C Hamano [Thu, 24 Jan 2013 05:19:10 +0000 (21:19 -0800)] 
Merge branch 'as/check-ignore'

Add a new command "git check-ignore" for debugging .gitignore
files.

The variable names may want to get cleaned up but that can be done
in-tree.

* as/check-ignore:
  clean.c, ls-files.c: respect encapsulation of exclude_list_groups
  t0008: avoid brace expansion
  add git-check-ignore sub-command
  setup.c: document get_pathspec()
  add.c: extract new die_if_path_beyond_symlink() for reuse
  add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
  pathspec.c: rename newly public functions for clarity
  add.c: move pathspec matchers into new pathspec.c for reuse
  add.c: remove unused argument from validate_pathspec()
  dir.c: improve docs for match_pathspec() and match_pathspec_depth()
  dir.c: provide clear_directory() for reclaiming dir_struct memory
  dir.c: keep track of where patterns came from
  dir.c: use a single struct exclude_list per source of excludes

Conflicts:
builtin/ls-files.c
dir.c

11 years agoMerge branch 'rs/clarify-entry-cmp-sslice'
Junio C Hamano [Thu, 24 Jan 2013 05:19:06 +0000 (21:19 -0800)] 
Merge branch 'rs/clarify-entry-cmp-sslice'

* rs/clarify-entry-cmp-sslice:
  refs: use strncmp() instead of strlen() and memcmp()

11 years agoMerge branch 'jk/suppress-clang-warning'
Junio C Hamano [Thu, 24 Jan 2013 05:19:00 +0000 (21:19 -0800)] 
Merge branch 'jk/suppress-clang-warning'

* jk/suppress-clang-warning:
  fix clang -Wunused-value warnings for error functions

11 years agoMerge branch 'cr/push-force-tag-update'
Junio C Hamano [Thu, 24 Jan 2013 05:16:49 +0000 (21:16 -0800)] 
Merge branch 'cr/push-force-tag-update'

Regression fix to stop "git push" complaining "target ref already
exists", when it is not the real reason the command rejected the
request (e.g. non-fast-forward).

* cr/push-force-tag-update:
  push: fix "refs/tags/ hierarchy cannot be updated without --force"

11 years agoMerge branch 'mh/imap-send-shrinkage'
Junio C Hamano [Thu, 24 Jan 2013 05:16:45 +0000 (21:16 -0800)] 
Merge branch 'mh/imap-send-shrinkage'

Remove a lot of unused code from "git imap-send".

* mh/imap-send-shrinkage:
  imap-send.c: simplify logic in lf_to_crlf()
  imap-send.c: fold struct store into struct imap_store
  imap-send.c: remove unused field imap_store::uidvalidity
  imap-send.c: use struct imap_store instead of struct store
  imap-send.c: remove unused field imap_store::trashnc
  imap-send.c: remove namespace fields from struct imap
  imap-send.c: remove struct imap argument to parse_imap_list_l()
  imap-send.c: inline parse_imap_list() in parse_list()
  imap-send.c: remove some unused fields from struct store
  imap-send.c: remove struct message
  imap-send.c: remove struct store_conf
  iamp-send.c: remove unused struct imap_store_conf
  imap-send.c: remove struct msg_data
  imap-send.c: remove msg_data::flags, which was always zero

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge git://ozlabs.org/~paulus/gitk
Junio 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

11 years agoMerge 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

11 years agoMakefile: Replace merge-file.h with merge-blobs.h in LIB_H
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>
11 years agoUpdate draft release notes to 1.8.2
Junio 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>
11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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>

11 years agoMerge 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

11 years agogit-for-each-ref.txt: 'raw' is a supported date format
John 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>
11 years agoUpdate draft release notes to 1.8.2
Junio 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>
11 years agoMerge branch 'maint'
Junio C Hamano [Mon, 21 Jan 2013 01:27:27 +0000 (17:27 -0800)] 
Merge branch 'maint'

11 years agoStart preparing for 1.8.1.2
Junio 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>
11 years agoMerge branch 'nz/send-email-headers-are-case-insensitive' into maint
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

11 years agoMerge branch 'rs/zip-with-uncompressed-size-in-the-header' into maint
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

11 years agoMerge branch 'rs/zip-tests' into maint
Junio 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

11 years agoMerge git://git.bogomips.org/git-svn
Junio 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

11 years agoMerge 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

11 years agoMerge 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

11 years agogit-svn: do not escape certain characters in paths
Peter 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>
11 years agoMerge git://bogomips.org/git-svn
Junio 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

11 years agoUpdate draft release notes to 1.8.2
Junio 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>
11 years agoMerge 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

11 years agoMerge 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_*

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoMerge 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

11 years agoAdd sample pre-push hook script
Aaron Schrab [Sun, 13 Jan 2013 05:17:04 +0000 (00:17 -0500)] 
Add sample pre-push hook script

Create a sample of a script for a pre-push hook.  The main purpose is to
illustrate how a script may parse the information which is supplied to
such a hook.  The script may also be useful to some people as-is for
avoiding to push commits which are marked as a work in progress.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopush: Add support for pre-push hooks
Aaron Schrab [Sun, 13 Jan 2013 05:17:03 +0000 (00:17 -0500)] 
push: Add support for pre-push hooks

Add support for a pre-push hook which can be used to determine if the
set of refs to be pushed is suitable for the target repository.  The
hook is run with two arguments specifying the name and location of the
destination repository.

Information about what is to be pushed is provided by sending lines of
the following form to the hook's standard input:

  <local ref> SP <local sha1> SP <remote ref> SP <remote sha1> LF

If the hook exits with a non-zero status, the push will be aborted.

This will allow the script to determine if the push is acceptable based
on the target repository and branch(es), the commits which are to be
pushed, and even the source branches in some cases.

Signed-off-by: Aaron Schrab <aaron@schrab.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-svn: teach find-rev to find near matches
John 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>
11 years agogit 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>
11 years agoGit::SVN::Editor::T: pass $deletions to ->A and ->D
Jonathan 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>
11 years agoAdd Auto-Submitted header to post-receive-email
Chris Hiestand [Wed, 16 Jan 2013 17:29:14 +0000 (09:29 -0800)] 
Add Auto-Submitted header to post-receive-email

This conforms to RFC3834 and is useful in preventing eg
vacation auto-responders from replying by default

Signed-off-by: Chris Hiestand <chiestand@salk.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agopush: fix "refs/tags/ hierarchy cannot be updated without --force"
Junio C Hamano [Wed, 16 Jan 2013 21:02:27 +0000 (13:02 -0800)] 
push: fix "refs/tags/ hierarchy cannot be updated without --force"

When pushing to update a branch with a commit that is not a
descendant of the commit at the tip, a wrong message "already
exists" was given, instead of the correct "non-fast-forward", if we
do not have the object sitting in the destination repository at the
tip of the ref we are updating.

The primary cause of the bug is that the check in a new helper
function is_forwardable() assumed both old and new objects are
available and can be checked, which is not always the case.

The way the caller uses the result of this function is also wrong.
If the helper says "we do not want to let this push go through", the
caller unconditionally translates it into "we blocked it because the
destination already exists", which is not true at all in this case.

Fix this by doing these three things:

 * Remove unnecessary not_forwardable from "struct ref"; it is only
   used inside set_ref_status_for_push();

 * Make "refs/tags/" the only hierarchy that cannot be replaced
   without --force;

 * Remove the misguided attempt to force that everything that
   updates an existing ref has to be a commit outside "refs/tags/"
   hierarchy.

The policy last one tried to implement may later be resurrected and
extended to ensure fast-forwardness (defined as "not losing
objects", extending from the traditional "not losing commits from
the resulting history") when objects that are not commit are
involved (e.g. an annotated tag in hierarchies outside refs/tags),
but such a logic belongs to "is this a fast-forward?" check that is
done by ref_newer(); is_forwardable(), which is now removed, was not
the right place to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoreset: update documentation to require only tree-ish with paths
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>
11 years agofix clang -Wunused-value warnings for error functions
Max Horn [Wed, 16 Jan 2013 18:09:29 +0000 (10:09 -0800)] 
fix clang -Wunused-value warnings for error functions

Commit a469a10 wraps some error calls in macros to give the
compiler a chance to do more static analysis on their
constant -1 return value.  We limit the use of these macros
to __GNUC__, since gcc is the primary beneficiary of the new
information, and because we use GNU features for handling
variadic macros.

However, clang also defines __GNUC__, but generates warnings
with -Wunused-value when these macros are used in a void
context, because the constant "-1" ends up being useless.
Gcc does not complain about this case (though it is unclear
if it is because it is smart enough to see what we are
doing, or too dumb to realize that the -1 is unused).  We
can squelch the warning by just disabling these macros when
clang is in use.

Signed-off-by: Max Horn <max@quendi.de>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr: avoid calling find_basename() twice per path
Duy 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>
11 years agorefs: use strncmp() instead of strlen() and memcmp()
René Scharfe [Wed, 16 Jan 2013 01:08:16 +0000 (02:08 +0100)] 
refs: use strncmp() instead of strlen() and memcmp()

Simplify ref_entry_cmp_sslice() by using strncmp() to compare the
length-limited key and a NUL-terminated entry.  While we're at it,
retain the const attribute of the input pointers.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoclean.c, ls-files.c: respect encapsulation of exclude_list_groups
Adam Spiers [Wed, 16 Jan 2013 13:25:58 +0000 (13:25 +0000)] 
clean.c, ls-files.c: respect encapsulation of exclude_list_groups

Consumers of the dir.c traversal API should avoid assuming knowledge
of the internal implementation of exclude_list_groups.  Therefore
when adding items to an exclude list, it should be accessed via the
pointer returned from add_exclude_list(), rather than by referencing
a location within dir.exclude_list_groups[EXC_CMDL].

Signed-off-by: Adam Spiers <git@adamspiers.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: simplify logic in lf_to_crlf()
Michael Haggerty [Tue, 15 Jan 2013 08:06:32 +0000 (09:06 +0100)] 
imap-send.c: simplify logic in lf_to_crlf()

* The first character in the string used to be special-cased to get
  around the fact that msg->buf[i - 1] is not defined for i == 0.
  Instead, keep track of the previous character in a separate
  variable, "lastc", initialized in such a way to let the loop handle
  i == 0 correctly.

* Make the two loops over the string look as similar as possible to
  make it more obvious that the count computed in the first pass
  agrees with the true length of the new string written in the second
  pass.  As a side effect, this makes it possible to use the "j"
  counter in place of lfnum and new_len.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: fold struct store into struct imap_store
Michael Haggerty [Tue, 15 Jan 2013 08:06:31 +0000 (09:06 +0100)] 
imap-send.c: fold struct store into struct imap_store

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove unused field imap_store::uidvalidity
Michael Haggerty [Tue, 15 Jan 2013 08:06:30 +0000 (09:06 +0100)] 
imap-send.c: remove unused field imap_store::uidvalidity

I suspect that the existence of both imap_store::uidvalidity and
store::uidvalidity was an accident.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: use struct imap_store instead of struct store
Michael Haggerty [Tue, 15 Jan 2013 08:06:29 +0000 (09:06 +0100)] 
imap-send.c: use struct imap_store instead of struct store

In fact, all struct store instances are upcasts of struct imap_store
anyway, so stop making the distinction.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove unused field imap_store::trashnc
Michael Haggerty [Tue, 15 Jan 2013 08:06:28 +0000 (09:06 +0100)] 
imap-send.c: remove unused field imap_store::trashnc

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove namespace fields from struct imap
Michael Haggerty [Tue, 15 Jan 2013 08:06:27 +0000 (09:06 +0100)] 
imap-send.c: remove namespace fields from struct imap

They are unused, and their removal means that a bunch of list-related
infrastructure can be disposed of.

It might be that the "NAMESPACE" response that is now skipped over in
get_cmd_result() should never be sent by the server.  But somebody
would have to check the IMAP protocol and how we interact with the
server to be sure.  So for now I am leaving that branch of the "if"
statement there.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove struct imap argument to parse_imap_list_l()
Michael Haggerty [Tue, 15 Jan 2013 08:06:26 +0000 (09:06 +0100)] 
imap-send.c: remove struct imap argument to parse_imap_list_l()

It was always set to NULL.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: inline parse_imap_list() in parse_list()
Michael Haggerty [Tue, 15 Jan 2013 08:06:25 +0000 (09:06 +0100)] 
imap-send.c: inline parse_imap_list() in parse_list()

The function is only called from here.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove some unused fields from struct store
Michael Haggerty [Tue, 15 Jan 2013 08:06:24 +0000 (09:06 +0100)] 
imap-send.c: remove some unused fields from struct store

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoconfig.txt: Document help.htmlpath config parameter
Sebastian 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>
11 years agoimap-send.c: remove struct message
Michael Haggerty [Tue, 15 Jan 2013 08:06:23 +0000 (09:06 +0100)] 
imap-send.c: remove struct message

It was never used.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove struct store_conf
Michael Haggerty [Tue, 15 Jan 2013 08:06:22 +0000 (09:06 +0100)] 
imap-send.c: remove struct store_conf

It was never used.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoiamp-send.c: remove unused struct imap_store_conf
Michael Haggerty [Tue, 15 Jan 2013 08:06:21 +0000 (09:06 +0100)] 
iamp-send.c: remove unused struct imap_store_conf

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove struct msg_data
Michael Haggerty [Tue, 15 Jan 2013 08:06:20 +0000 (09:06 +0100)] 
imap-send.c: remove struct msg_data

Now that its flags member has been deleted, all that is left is a
strbuf.  So use a strbuf directly.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoimap-send.c: remove msg_data::flags, which was always zero
Michael Haggerty [Tue, 15 Jan 2013 08:06:19 +0000 (09:06 +0100)] 
imap-send.c: remove msg_data::flags, which was always zero

This removes the need for function imap_make_flags(), so delete it,
too.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest-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>
11 years agoattr: make it build with DEBUG_ATTR again
Nguyễ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>
11 years agoremote-hg: fix handling of file perms when pushing
Max 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>
11 years agoremote-hg: store converted URL
Felipe 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>
11 years agogit p4: fix submit when no master branch
Pete 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>
11 years agogit p4 test: keep P4CLIENT changes inside subshells
Pete 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>
11 years agogit p4: fix sync --branch when no master branch
Pete 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>
11 years agogit p4: fail gracefully on sync with no master branch
Pete 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>
11 years agogit p4: rearrange self.initialParent use
Pete 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>
11 years agogit p4: allow short ref names to --branch
Pete 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>
11 years agogit p4 doc: fix branch detection example
Pete 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>
11 years agogit p4: clone --branch should checkout master
Pete 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>
11 years agogit p4: verify expected refs in clone --bare test
Pete 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>
11 years agogit p4: create p4/HEAD on initial clone
Pete 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>
11 years agogit p4: inline listExistingP4GitBranches
Pete 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>
11 years agogit p4: add comments to p4BranchesInGit
Pete 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>
11 years agogit p4: rearrange and simplify hasOrigin handling
Pete 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>
11 years agogit p4: test sync/clone --branch behavior
Pete 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>
11 years agoreset [--mixed]: use diff-based reset whether or not pathspec was given
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>