]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
10 years agoMerge branch 'al/docs'
Junio C Hamano [Thu, 27 Feb 2014 22:01:43 +0000 (14:01 -0800)] 
Merge branch 'al/docs'

A handful of documentation updates, all trivially harmless.

* al/docs:
  docs/git-blame: explain more clearly the example pickaxe use
  docs/git-clone: clarify use of --no-hardlinks option
  docs/git-remote: capitalize first word of initial blurb
  docs/merge-strategies: remove hyphen from mis-merges

10 years agoMerge branch 'jk/test-ports'
Junio C Hamano [Thu, 27 Feb 2014 22:01:42 +0000 (14:01 -0800)] 
Merge branch 'jk/test-ports'

Avoid having to assign port number to be used in tests manually.

* jk/test-ports:
  tests: auto-set git-daemon port
  tests: auto-set LIB_HTTPD_PORT from test name

10 years agoMerge branch 'nd/reset-intent-to-add'
Junio C Hamano [Thu, 27 Feb 2014 22:01:40 +0000 (14:01 -0800)] 
Merge branch 'nd/reset-intent-to-add'

* nd/reset-intent-to-add:
  reset: support "--mixed --intent-to-add" mode

10 years agoMerge branch 'ks/tree-diff-walk'
Junio C Hamano [Thu, 27 Feb 2014 22:01:38 +0000 (14:01 -0800)] 
Merge branch 'ks/tree-diff-walk'

* ks/tree-diff-walk:
  tree-walk: finally switch over tree descriptors to contain a pre-parsed entry
  revision: convert to using diff_tree_sha1()
  line-log: convert to using diff_tree_sha1()
  tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL
  tree-diff: allow diff_tree_sha1 to accept NULL sha1

10 years agoMerge branch 'mw/symlinks'
Junio C Hamano [Thu, 27 Feb 2014 22:01:37 +0000 (14:01 -0800)] 
Merge branch 'mw/symlinks'

All subcommands that take pathspecs mishandled an in-tree symbolic
link when given it as a full path from the root (which arguably is
a sick way to use pathspecs).  "git ls-files -s $(pwd)/RelNotes" in
our tree is an easy reproduction recipe.

* mw/symlinks:
  setup: don't dereference in-tree symlinks for absolute paths
  setup: add abspath_part_inside_repo() function
  t0060: add tests for prefix_path when path begins with work tree
  t0060: add test for prefix_path when path == work tree
  t0060: add test for prefix_path on symlinks via absolute paths
  t3004: add test for ls-files on symlinks via absolute paths

10 years agoMerge branch 'nd/test-rename-reset'
Junio C Hamano [Thu, 27 Feb 2014 22:01:35 +0000 (14:01 -0800)] 
Merge branch 'nd/test-rename-reset'

* nd/test-rename-reset:
  t7101, t7014: rename test files to indicate what that file is for

10 years agoMerge branch 'wk/submodule-on-branch'
Junio C Hamano [Thu, 27 Feb 2014 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'wk/submodule-on-branch'

Make sure 'submodule update' modes that do not detach HEADs can
be used more pleasantly by checking out a concrete branch when
cloning them to prime the well.

* wk/submodule-on-branch:
  Documentation: describe 'submodule update --remote' use case
  submodule: explicit local branch creation in module_clone
  submodule: document module_clone arguments in comments
  submodule: make 'checkout' update_module mode more explicit

10 years agoMerge branch 'ep/varscope'
Junio C Hamano [Thu, 27 Feb 2014 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'ep/varscope'

Shrink lifetime of variables by moving their definitions to an
inner scope where appropriate.

* ep/varscope:
  builtin/gc.c: reduce scope of variables
  builtin/fetch.c: reduce scope of variable
  builtin/commit.c: reduce scope of variables
  builtin/clean.c: reduce scope of variable
  builtin/blame.c: reduce scope of variables
  builtin/apply.c: reduce scope of variables
  bisect.c: reduce scope of variable

10 years agoMerge branch 'bs/stdio-undef-before-redef'
Junio C Hamano [Thu, 27 Feb 2014 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'bs/stdio-undef-before-redef'

When we replace broken macros from stdio.h in git-compat-util.h,
preprocessor.

* bs/stdio-undef-before-redef:
  git-compat-util.h: #undef (v)snprintf before #define them

10 years agoMerge branch 'jk/config-path-include-fix'
Junio C Hamano [Thu, 27 Feb 2014 22:01:25 +0000 (14:01 -0800)] 
Merge branch 'jk/config-path-include-fix'

include.path variable (or any variable that expects a path that can
use ~username expansion) in the configuration file is not a
boolean, but the code failed to check it.

* jk/config-path-include-fix:
  handle_path_include: don't look at NULL value
  expand_user_path: do not look at NULL path

10 years agoMerge branch 'ds/rev-parse-required-args'
Junio C Hamano [Thu, 27 Feb 2014 22:01:23 +0000 (14:01 -0800)] 
Merge branch 'ds/rev-parse-required-args'

"git rev-parse --default" without the required option argument did
not diagnose it as an error.

* ds/rev-parse-required-args:
  rev-parse: check i before using argv[i] against argc

10 years agoMerge branch 'nd/diff-quiet-stat-dirty'
Junio C Hamano [Thu, 27 Feb 2014 22:01:21 +0000 (14:01 -0800)] 
Merge branch 'nd/diff-quiet-stat-dirty'

"git diff --quiet -- pathspec1 pathspec2" sometimes did not return
correct status value.

* nd/diff-quiet-stat-dirty:
  diff: do not quit early on stat-dirty files
  diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later

10 years agoMerge branch 'nd/submodule-pathspec-ending-with-slash'
Junio C Hamano [Thu, 27 Feb 2014 22:01:15 +0000 (14:01 -0800)] 
Merge branch 'nd/submodule-pathspec-ending-with-slash'

Allow "git cmd path/", when the 'path' is where a submodule is
bound to the top-level working tree, to match 'path', despite the
extra and unnecessary trailing slash.

* nd/submodule-pathspec-ending-with-slash:
  clean: use cache_name_is_other()
  clean: replace match_pathspec() with dir_path_match()
  pathspec: pass directory indicator to match_pathspec_item()
  match_pathspec: match pathspec "foo/" against directory "foo"
  dir.c: prepare match_pathspec_item for taking more flags
  pathspec: rename match_pathspec_depth() to match_pathspec()
  pathspec: convert some match_pathspec_depth() to dir_path_match()
  pathspec: convert some match_pathspec_depth() to ce_path_match()

10 years agoMerge branch 'bk/refresh-missing-ok-in-merge-recursive'
Junio C Hamano [Thu, 27 Feb 2014 22:01:14 +0000 (14:01 -0800)] 
Merge branch 'bk/refresh-missing-ok-in-merge-recursive'

Allow "merge-recursive" to work in an empty (temporary) working
tree again when there are renames involved, correcting an old
regression in 1.7.7 era.

* bk/refresh-missing-ok-in-merge-recursive:
  merge-recursive.c: tolerate missing files while refreshing index
  read-cache.c: extend make_cache_entry refresh flag with options
  read-cache.c: refactor --ignore-missing implementation
  t3030-merge-recursive: test known breakage with empty work tree

10 years agoMerge branch 'da/pull-ff-configuration'
Junio C Hamano [Thu, 27 Feb 2014 22:01:11 +0000 (14:01 -0800)] 
Merge branch 'da/pull-ff-configuration'

"git pull" learned to pay attention to pull.ff configuration
variable.

* da/pull-ff-configuration:
  pull: add --ff-only to the help text
  pull: add pull.ff configuration

10 years agoMerge branch 'kb/fast-hashmap'
Junio C Hamano [Thu, 27 Feb 2014 22:01:09 +0000 (14:01 -0800)] 
Merge branch 'kb/fast-hashmap'

Improvements to our hash table to get it to meet the needs of the
msysgit fscache project, with some nice performance improvements.

* kb/fast-hashmap:
  name-hash: retire unused index_name_exists()
  hashmap.h: use 'unsigned int' for hash-codes everywhere
  test-hashmap.c: drop unnecessary #includes
  .gitignore: test-hashmap is a generated file
  read-cache.c: fix memory leaks caused by removed cache entries
  builtin/update-index.c: cleanup update_one
  fix 'git update-index --verbose --again' output
  remove old hash.[ch] implementation
  name-hash.c: remove cache entries instead of marking them CE_UNHASHED
  name-hash.c: use new hash map implementation for cache entries
  name-hash.c: remove unreferenced directory entries
  name-hash.c: use new hash map implementation for directories
  diffcore-rename.c: use new hash map implementation
  diffcore-rename.c: simplify finding exact renames
  diffcore-rename.c: move code around to prepare for the next patch
  buitin/describe.c: use new hash map implementation
  add a hashtable implementation that supports O(1) removal
  submodule: don't access the .gitmodules cache entry after removing it

10 years agoMerge branch 'nv/commit-gpgsign-config'
Junio C Hamano [Thu, 27 Feb 2014 22:01:03 +0000 (14:01 -0800)] 
Merge branch 'nv/commit-gpgsign-config'

Introduce commit.gpgsign configuration variable to force every
commit to be GPG signed.  The variable cannot be overriden from the
command line of some of the commands that create commits except for
"git commit" and "git commit-tree", but I am not convinced that it
is a good idea to sprinkle support for --no-gpg-sign everywhere,
which in turn means that this configuration variable may not be
such a good idea.

* nv/commit-gpgsign-config:
  test the commit.gpgsign config option
  commit-tree: add and document --no-gpg-sign
  commit-tree: add the commit.gpgsign option to sign all commits

10 years agoname-hash: retire unused index_name_exists()
Eric Sunshine [Thu, 2 Jan 2014 21:57:12 +0000 (16:57 -0500)] 
name-hash: retire unused index_name_exists()

db5360f3f496 (name-hash: refactor polymorphic index_name_exists();
2013-09-17) split index_name_exists() into index_file_exists() and
index_dir_exists() but retained index_name_exists() as a thin wrapper
to avoid disturbing possible in-flight topics. Since this change
landed in 'master' some time ago and there are no in-flight topics
referencing index_name_exists(), retire it.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohashmap.h: use 'unsigned int' for hash-codes everywhere
Karsten Blees [Wed, 18 Dec 2013 13:41:27 +0000 (14:41 +0100)] 
hashmap.h: use 'unsigned int' for hash-codes everywhere

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotest the commit.gpgsign config option
Nicolas Vigier [Mon, 16 Dec 2013 13:55:04 +0000 (14:55 +0100)] 
test the commit.gpgsign config option

The tests are checking that :

- when commit.gpgsign is true, "git commit" creates signed commits

- when commit.gpgsign is false, "git commit" creates unsigned commits

- when commit.gpgsign is true, "git commit --no-gpg-sign" creates
  unsigned commits

- when commit.gpgsign is true, "git rebase -f" creates signed commits

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit-tree: add and document --no-gpg-sign
Junio C Hamano [Fri, 13 Dec 2013 23:40:35 +0000 (15:40 -0800)] 
commit-tree: add and document --no-gpg-sign

Document how to override commit.gpgsign configuration that is set to
true per "git commit" invocation (parse-options machinery lets us
say "--no-gpg-sign" to do so).

"git commit-tree" does not use parse-options, so manually add the
corresponding option for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit-tree: add the commit.gpgsign option to sign all commits
Nicolas Vigier [Mon, 4 Nov 2013 23:14:41 +0000 (00:14 +0100)] 
commit-tree: add the commit.gpgsign option to sign all commits

If you want to GPG sign all your commits, you have to add the -S option
all the time. The commit.gpgsign config option allows to sign all
commits automatically.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff: do not quit early on stat-dirty files
Nguyễn Thái Ngọc Duy [Sat, 25 Jan 2014 06:46:50 +0000 (13:46 +0700)] 
diff: do not quit early on stat-dirty files

When QUICK is set (i.e. with --quiet) we try to do as little work as
possible, stopping after seeing the first change. stat-dirty is
considered a "change" but it may turn out not, if no actual content is
changed. The actual content test is performed too late in the process
and the shortcut may be taken prematurely, leading to incorrect return
code.

Assume we do "git diff --quiet". If we have a stat-dirty file "a" and
a really dirty file "b". We break the loop in run_diff_files() and
stop after "a" because we have got a "change". Later in
diffcore_skip_stat_unmatch() we find out "a" is actually not
changed. But there's nothing else in the diff queue, we incorrectly
declare "no change", ignoring the fact that "b" is changed.

This also happens to "git diff --quiet HEAD" when it hits
diff_can_quit_early() in oneway_diff().

This patch does the content test earlier in order to keep going if "a"
is unchanged. The test result is cached so that when
diffcore_skip_stat_unmatch() is done in the end, we spend no cycles on
re-testing "a".

Reported-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff.c: move diffcore_skip_stat_unmatch core logic out for reuse later
Nguyễn Thái Ngọc Duy [Sat, 25 Jan 2014 06:46:49 +0000 (13:46 +0700)] 
diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotree-walk: finally switch over tree descriptors to contain a pre-parsed entry
Kirill Smelkov [Thu, 6 Feb 2014 11:36:31 +0000 (15:36 +0400)] 
tree-walk: finally switch over tree descriptors to contain a pre-parsed entry

This continues 4651ece8 (Switch over tree descriptors to contain a
pre-parsed entry) and moves the only rest computational part

    mode = canon_mode(mode)

from tree_entry_extract() to tree entry decode phase - to
decode_tree_entry().

The reason to do it, is that canon_mode() is at least 2 conditional
jumps for regular files, and that could be noticeable should canon_mode()
be invoked several times.

That does not matter for current Git codebase, where typical tree
traversal is

    while (t->size) {
        sha1 = tree_entry_extract(t, &path, &mode);
        ...
        update_tree_entry(t);
    }

i.e. we do t -> sha1,path.mode "extraction" only once per entry. In such
cases, it does not matter performance-wise, where that mode
canonicalization is done - either once in tree_entry_extract(), or once
in decode_tree_entry() called by update_tree_entry() - it is
approximately the same.

But for future code, which could need to work with several tree_desc's
in parallel, it could be handy to operate on tree_desc descriptors, and
do "extracts" only when needed, or at all, access only relevant part of
it through structure fields directly.

And for such situations, having canon_mode() be done once in decode
phase is better - we won't need to pay the performance price of 2 extra
conditional jumps on every t->mode access.

So let's move mode canonicalization to decode_tree_entry(). That was the
final bit. Now after tree entry is decoded, it is fully ready and could
be accessed either directly via field, or through tree_entry_extract()
which this time got really "totally trivial".

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoclean: use cache_name_is_other()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:35 +0000 (20:40 +0700)] 
clean: use cache_name_is_other()

cmd_clean() has the exact same code of index_name_is_other(). Reduce
code duplication.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoclean: replace match_pathspec() with dir_path_match()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:34 +0000 (20:40 +0700)] 
clean: replace match_pathspec() with dir_path_match()

This instance was left out when many match_pathspec() call sites that
take input from dir_entry were converted to dir_path_match() because
it passed a path with the trailing slash stripped out to match_pathspec()
while the others did not. Stripping for all call sites back then would
be a regression because match_pathspec() did not know how to match
pathspec foo/ against _directory_ foo (the stripped version of path
"foo/").

match_pathspec() knows how to do it now. And dir_path_match() strips
the trailing slash also. Use the new function, because the stripping
code is removed in the next patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopathspec: pass directory indicator to match_pathspec_item()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:33 +0000 (20:40 +0700)] 
pathspec: pass directory indicator to match_pathspec_item()

This patch activates the DO_MATCH_DIRECTORY code in m_p_i(), which
makes "git diff HEAD submodule/" and "git diff HEAD submodule" produce
the same output. Previously only the version without trailing slash
returns the difference (if any).

That's the effect of new ce_path_match(). dir_path_match() is not
executed by the new tests. And it should not introduce regressions.

Previously if path "dir/" is passed in with pathspec "dir/", they
obviously match. With new dir_path_match(), the path becomes
_directory_ "dir" vs pathspec "dir/", which is not executed by the old
code path in m_p_i(). The new code path is executed and produces the
same result.

The other case is pathspec "dir" and path "dir/" is now turned to
"dir" (with DO_MATCH_DIRECTORY). Still the same result before or after
the patch.

So why change? Because of the next patch about clean.c.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomatch_pathspec: match pathspec "foo/" against directory "foo"
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:32 +0000 (20:40 +0700)] 
match_pathspec: match pathspec "foo/" against directory "foo"

Currently we do support matching pathspec "foo/" against directory
"foo". That is because match_pathspec() has no way to tell "foo" is a
directory and matching "foo/" against _file_ "foo" is wrong.

The callers can now tell match_pathspec if "foo" is a directory, we
could make an exception for this case. Code is not executed though
because no callers pass the flag yet.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodir.c: prepare match_pathspec_item for taking more flags
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:31 +0000 (20:40 +0700)] 
dir.c: prepare match_pathspec_item for taking more flags

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopathspec: rename match_pathspec_depth() to match_pathspec()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:30 +0000 (20:40 +0700)] 
pathspec: rename match_pathspec_depth() to match_pathspec()

A long time ago, for some reason I was not happy with
match_pathspec(). I created a better version, match_pathspec_depth()
that was suppose to replace match_pathspec()
eventually. match_pathspec() has finally been gone since 6 months
ago. Use the shorter name for match_pathspec_depth().

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopathspec: convert some match_pathspec_depth() to dir_path_match()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:29 +0000 (20:40 +0700)] 
pathspec: convert some match_pathspec_depth() to dir_path_match()

This helps reduce the number of match_pathspec_depth() call sites and
show how m_p_d() is used. And it usage is:

 - match against an index entry (ce_path_match or match_pathspec_depth
   in ls-files)

 - match against a dir_entry from read_directory (dir_path_match and
   match_pathspec_depth in clean.c, which will be converted later)

 - resolve-undo (rerere.c and ls-files.c)

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopathspec: convert some match_pathspec_depth() to ce_path_match()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:28 +0000 (20:40 +0700)] 
pathspec: convert some match_pathspec_depth() to ce_path_match()

This helps reduce the number of match_pathspec_depth() call sites and
show how match_pathspec_depth() is used.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoDocumentation: describe 'submodule update --remote' use case
W. Trevor King [Sun, 26 Jan 2014 20:45:16 +0000 (12:45 -0800)] 
Documentation: describe 'submodule update --remote' use case

Make it clear that there is no implicit floating going on; --remote
lets you explicitly integrate the upstream branch in your current
HEAD (just like running 'git pull' in the submodule).  The only
distinction with the current 'git pull' is the config location and
setting used for the upstream branch, which is hopefully clear now.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule: explicit local branch creation in module_clone
W. Trevor King [Sun, 26 Jan 2014 20:45:15 +0000 (12:45 -0800)] 
submodule: explicit local branch creation in module_clone

The previous code only checked out branches in cmd_add.  This commit
moves the branch-checkout logic into module_clone, where it can be
shared by cmd_add and cmd_update.  I also update the initial checkout
command to use 'reset' to preserve branches setup during module_clone.

With this change, folks cloning submodules for the first time via:

  $ git submodule update ...

will get a local branch instead of a detached HEAD, unless they are
using the default checkout-mode updates.  This is a change from the
previous situation where cmd_update always used checkout-mode logic
(regardless of the requested update mode) for updates that triggered
an initial clone, which always resulted in a detached HEAD.

This commit does not change the logic for updates after the initial
clone, which will continue to create detached HEADs for checkout-mode
updates, and integrate remote work with the local HEAD (detached or
not) in other modes.

The motivation for the change is that developers doing local work
inside the submodule are likely to select a non-checkout-mode for
updates so their local work is integrated with upstream work.
Developers who are not doing local submodule work stick with
checkout-mode updates so any apparently local work is blown away
during updates.  For example, if upstream rolls back the remote branch
or gitlinked commit to an earlier version, the checkout-mode developer
wants their old submodule checkout to be rolled back as well, instead
of getting a no-op merge/rebase with the rolled-back reference.

By using the update mode to distinguish submodule developers from
black-box submodule consumers, we can setup local branches for the
developers who will want local branches, and stick with detached HEADs
for the developers that don't care.

Testing
=======

In t7406, just-cloned checkouts now update to the gitlinked hash with
'reset', to preserve the local branch for situations where we're not
on a detached HEAD.

I also added explicit tests to t7406 for HEAD attachement after
cloning updates, showing that it depends on their update mode:

* Checkout-mode updates get detached HEADs
* Everyone else gets a local branch, matching the configured
  submodule.<name>.branch and defaulting to master.

The 'initial-setup' tag makes it easy to reset the superproject to a
known state, as several earlier tests commit to submodules and commit
the changed gitlinks to the superproject, but don't push the new
submodule commits to the upstream subprojects.  This makes it
impossible to checkout the current super master, because it references
submodule commits that don't exist in the upstream subprojects.  For a
specific example, see the tests that currently generate the
'two_new_submodule_commits' commits.

Documentation
=============

I updated the docs to describe the 'submodule update' modes in detail.
The old documentation did not distinguish between cloning and
non-cloning updates and lacked clarity on which operations would lead
to detached HEADs, and which would not.  The new documentation
addresses these issues while updating the docs to reflect the changes
introduced by this commit's explicit local branch creation in
module_clone.

I also add '--checkout' to the usage summary and group the update-mode
options into a single set.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule: document module_clone arguments in comments
W. Trevor King [Thu, 16 Jan 2014 04:10:23 +0000 (20:10 -0800)] 
submodule: document module_clone arguments in comments

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule: make 'checkout' update_module mode more explicit
W. Trevor King [Thu, 16 Jan 2014 04:10:22 +0000 (20:10 -0800)] 
submodule: make 'checkout' update_module mode more explicit

This avoids the current awkwardness of having either '' or 'checkout'
for checkout-mode updates, which makes testing for checkout-mode
updates (or non-checkout-mode updates) easier.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotest-hashmap.c: drop unnecessary #includes
Jonathan Nieder [Sat, 14 Dec 2013 02:06:40 +0000 (18:06 -0800)] 
test-hashmap.c: drop unnecessary #includes

Per Documentation/CodingGuidelines most C files in git start with
a #include of git-compat-util.h or another header file that includes
it, such as cache.h or builtin.h.  This file doesn't need anything
beyond "git-compat-util.h", so use that.

Remove a #include of the system header <stdio.h> since it is already
included by "git-compat-util.h".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years ago.gitignore: test-hashmap is a generated file
Jonathan Nieder [Sat, 14 Dec 2013 02:05:26 +0000 (18:05 -0800)] 
.gitignore: test-hashmap is a generated file

Prevent the "test-hashmap" program from being accidentally tracked
with "git add" or cluttering "git status" output.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agomerge-recursive.c: tolerate missing files while refreshing index
Brad King [Mon, 27 Jan 2014 14:45:09 +0000 (09:45 -0500)] 
merge-recursive.c: tolerate missing files while refreshing index

Teach add_cacheinfo to tell make_cache_entry to skip refreshing stat
information when a file is missing from the work tree.  We do not want
the index to be stat-dirty after the merge but also do not want to fail
when a file happens to be missing.

This fixes the 'merge-recursive w/ empty work tree - ours has rename'
case in t3030-merge-recursive.

Suggested-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoread-cache.c: extend make_cache_entry refresh flag with options
Brad King [Mon, 27 Jan 2014 14:45:08 +0000 (09:45 -0500)] 
read-cache.c: extend make_cache_entry refresh flag with options

Convert the make_cache_entry boolean 'refresh' argument to a more
general 'refresh_options' argument.  Pass the value through to the
underlying refresh_cache_ent call.  Add option CE_MATCH_REFRESH to
enable stat refresh.  Update call sites to use the new signature.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoread-cache.c: refactor --ignore-missing implementation
Brad King [Mon, 27 Jan 2014 14:45:07 +0000 (09:45 -0500)] 
read-cache.c: refactor --ignore-missing implementation

Move lstat ENOENT handling from refresh_index to refresh_cache_ent and
activate it with a new CE_MATCH_IGNORE_MISSING option.  This will allow
other call paths into refresh_cache_ent to use the feature.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot3030-merge-recursive: test known breakage with empty work tree
Brad King [Mon, 27 Jan 2014 14:45:06 +0000 (09:45 -0500)] 
t3030-merge-recursive: test known breakage with empty work tree

Sometimes when working with a large repository it can be useful to try
out a merge and only check out conflicting files to disk (for example as
a speed optimization on a server).  Until v1.7.7-rc1~28^2~20
(merge-recursive: When we detect we can skip an update, actually skip
it, 2011-08-11), it was possible to do so with the following idiom:

# Prepare a temporary index and empty work tree.
GIT_INDEX_FILE="$PWD/tmp-$$-index" &&
export GIT_INDEX_FILE &&
GIT_WORK_TREE="$PWD/tmp-$$-work" &&
export GIT_WORK_TREE &&
mkdir "$GIT_WORK_TREE" &&

# Convince the index that our side is on disk.
git read-tree -i -m $ours &&
git update-index --ignore-missing --refresh &&

# Merge their side into our side.
bases=$(git merge-base --all $ours $theirs) &&
git merge-recursive $bases -- $ours $theirs &&
tree=$(git write-tree)

Nowadays, that still works and the exit status is the same, but
merge-recursive produces a diagnostic if "our" side renamed a file:

error: addinfo_cache failed for path 'dst'

Add a test to document this regression.

Signed-off-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 1.9.0 v1.9.0
Junio C Hamano [Fri, 14 Feb 2014 19:35:04 +0000 (11:35 -0800)] 
Git 1.9.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorelease notes: typo fixes
Michael J Gruber [Thu, 13 Feb 2014 10:35:08 +0000 (11:35 +0100)] 
release notes: typo fixes

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with 1.8.5.5
Junio C Hamano [Thu, 13 Feb 2014 21:42:26 +0000 (13:42 -0800)] 
Sync with 1.8.5.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 1.8.5.5 v1.8.5.5
Junio C Hamano [Thu, 13 Feb 2014 21:40:47 +0000 (13:40 -0800)] 
Git 1.8.5.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'bm/merge-base-octopus-dedup' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:59 +0000 (13:38 -0800)] 
Merge branch 'bm/merge-base-octopus-dedup' into maint

"git merge-base --octopus" used to leave cleaning up suboptimal
result to the caller, but now it does the clean-up itself.

* bm/merge-base-octopus-dedup:
  merge-base --octopus: reduce the result from get_octopus_merge_bases()
  merge-base: separate "--independent" codepath into its own helper

10 years agoMerge branch 'jc/revision-range-unpeel' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:47 +0000 (13:38 -0800)] 
Merge branch 'jc/revision-range-unpeel' into maint

"git log --left-right A...B" lost the "leftness" of commits
reachable from A when A is a tag as a side effect of a recent
bugfix.  This is a regression in 1.8.4.x series.

* jc/revision-range-unpeel:
  revision: propagate flag bits from tags to pointees
  revision: mark contents of an uninteresting tree uninteresting

10 years agoMerge branch 'jk/allow-fetch-onelevel-refname' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:34 +0000 (13:38 -0800)] 
Merge branch 'jk/allow-fetch-onelevel-refname' into maint

"git clone" would fail to clone from a repository that has a ref
directly under "refs/", e.g. "refs/stash", because different
validation paths do different things on such a refname.  Loosen the
client side's validation to allow such a ref.

* jk/allow-fetch-onelevel-refname:
  fetch-pack: do not filter out one-level refs

10 years agoMerge branch 'jk/interpret-branch-name-fix' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:25 +0000 (13:38 -0800)] 
Merge branch 'jk/interpret-branch-name-fix' into maint

A handful of bugs around interpreting $branch@{upstream} notation
and its lookalike, when $branch part has interesting characters,
e.g. "@", and ":", have been fixed.

* jk/interpret-branch-name-fix:
  interpret_branch_name: find all possible @-marks
  interpret_branch_name: avoid @{upstream} past colon
  interpret_branch_name: always respect "namelen" parameter
  interpret_branch_name: rename "cp" variable to "at"
  interpret_branch_name: factor out upstream handling

10 years agoMerge branch 'rk/send-email-ssl-cert' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:19 +0000 (13:38 -0800)] 
Merge branch 'rk/send-email-ssl-cert' into maint

A recent update to "git send-email" broke platforms where
/etc/ssl/certs/ directory exists but cannot be used as SSL_ca_path
(e.g. Fedora rawhide).

* rk/send-email-ssl-cert:
  send-email: /etc/ssl/certs/ directory may not be usable as ca_path

10 years agoMerge branch 'sb/repack-in-c' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:38:09 +0000 (13:38 -0800)] 
Merge branch 'sb/repack-in-c' into maint

"git repack --max-pack-size=8g" stopped being parsed correctly when
the command was reimplemented in C.

* sb/repack-in-c:
  repack: propagate pack-objects options as strings
  repack: make parsed string options const-correct
  repack: fix typo in max-pack-size option

10 years agoMerge branch 'as/tree-walk-fix-aggressive-short-cut' into maint
Junio C Hamano [Thu, 13 Feb 2014 21:37:53 +0000 (13:37 -0800)] 
Merge branch 'as/tree-walk-fix-aggressive-short-cut' into maint

The pathspec matching code, while comparing two trees (e.g. "git
diff A B -- path1 path2") was too aggressive and failed to match
some paths when multiple pathspecs were involved.

* as/tree-walk-fix-aggressive-short-cut:
  tree_entry_interesting: match against all pathspecs

10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Wed, 12 Feb 2014 20:28:47 +0000 (12:28 -0800)] 
Merge git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
  l10n: de.po: correct message when hiding commits by craft
  l10n: de.po: translate 28 new messages

10 years agol10n: de.po: correct message when hiding commits by craft
Ralf Thielow [Sat, 8 Feb 2014 21:01:36 +0000 (22:01 +0100)] 
l10n: de.po: correct message when hiding commits by craft

The recent translation was giving the idea that all commits
based on a graft were meant to be hidden. Make it clear that
it is the graft commit itself.

Reported-by: David Kastrup <dak@gnu.org>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
10 years agol10n: de.po: translate 28 new messages
Ralf Thielow [Fri, 3 Jan 2014 17:38:12 +0000 (18:38 +0100)] 
l10n: de.po: translate 28 new messages

Translate 28 new messages came from git.pot update in
df49095 (l10n: git.pot: v1.9 round 1 (27 new, 11 removed)
and d57b24b (l10n: git.pot: v1.9 round 2 (1 new)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
10 years agodocs/git-blame: explain more clearly the example pickaxe use
Albert L. Lash, IV [Sat, 8 Feb 2014 20:41:37 +0000 (15:41 -0500)] 
docs/git-blame: explain more clearly the example pickaxe use

We state that the following paragraph mentions the pickaxe
interface, but the term pickaxe is not then used. This
change clarifies that the example command uses the pickaxe
interface and what it is searching for.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodocs/git-clone: clarify use of --no-hardlinks option
Albert L. Lash, IV [Sat, 8 Feb 2014 20:41:36 +0000 (15:41 -0500)] 
docs/git-clone: clarify use of --no-hardlinks option

Current text claims optimization, implying the use of
hardlinks, when this option ratchets down the level of
efficiency. This change explains the difference made by
using this option, namely copying instead of hardlinking,
and why it may be useful.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodocs/git-remote: capitalize first word of initial blurb
Albert L. Lash, IV [Sat, 8 Feb 2014 20:41:35 +0000 (15:41 -0500)] 
docs/git-remote: capitalize first word of initial blurb

All other man files have capitalized descriptions which
immediately follow the command's name. Let's capitalize
this one too for consistency.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodocs/merge-strategies: remove hyphen from mis-merges
Albert L. Lash, IV [Sat, 8 Feb 2014 20:41:34 +0000 (15:41 -0500)] 
docs/merge-strategies: remove hyphen from mis-merges

The term mismerges without hyphen is used a few other
places in the documentation. Let's update this to
be consistent.

Signed-off-by: Albert L. Lash, IV <alash3@bloomberg.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Tue, 11 Feb 2014 19:02:05 +0000 (11:02 -0800)] 
Merge git://github.com/git-l10n/git-po

* 'master' of git://github.com/git-l10n/git-po:
  l10n: zh_CN.po: Disambiguation for rebase
  l10n: zh_CN.po: translate 1 new message (2211t0f0u)
  l10n: vi.po (2211t): Updated one new string
  l10n: Update Swedish translation (2211t0f0u)
  l10n: fr: 1.9rc2 2211t
  l10n: git.pot: v1.9 round 2 (1 new)

10 years agotests: auto-set git-daemon port
Jeff King [Mon, 10 Feb 2014 19:16:38 +0000 (14:16 -0500)] 
tests: auto-set git-daemon port

A recent commit taught lib-httpd to always start apache on
the same port as the numbered tests. Let's do the same for
the git-daemon tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotests: auto-set LIB_HTTPD_PORT from test name
Jeff King [Mon, 10 Feb 2014 14:39:48 +0000 (09:39 -0500)] 
tests: auto-set LIB_HTTPD_PORT from test name

We set the default apache port for each of the httpd tests
to the 4-digit test number of the test script. We want these
to remain unique so that the tests do not conflict with each
other when run in parallel.

Instead of doing it manually in each test script, let's just
set it from the test name at run time. This is simpler, and
is one less thing to be updated when test scripts are
renamed (e.g., when being re-rolled or when conflicting
after being merged with another topic).

Incidentally, this fixes a case where t5537 and t5538 used
the same port number (5537), and could conflict with each
other when run in parallel.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 1.9.0-rc3 v1.9.0-rc3
Junio C Hamano [Fri, 7 Feb 2014 19:56:07 +0000 (11:56 -0800)] 
Git 1.9.0-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'ow/manpages-typofix'
Junio C Hamano [Fri, 7 Feb 2014 19:55:11 +0000 (11:55 -0800)] 
Merge branch 'ow/manpages-typofix'

Various typofixes, all looked correct.

* ow/manpages-typofix:
  Documentation: fix typos in man pages

10 years agoMerge branch 'aj/ada-diff-word-pattern'
Junio C Hamano [Fri, 7 Feb 2014 19:55:10 +0000 (11:55 -0800)] 
Merge branch 'aj/ada-diff-word-pattern'

* aj/ada-diff-word-pattern:
  userdiff: update Ada patterns

10 years agoMerge branch 'nd/tag-doc'
Junio C Hamano [Fri, 7 Feb 2014 19:55:06 +0000 (11:55 -0800)] 
Merge branch 'nd/tag-doc'

* nd/tag-doc:
  git-tag.txt: <commit> for --contains is optional

10 years agol10n: zh_CN.po: Disambiguation for rebase
Jiang Xin [Sun, 2 Feb 2014 12:46:58 +0000 (20:46 +0800)] 
l10n: zh_CN.po: Disambiguation for rebase

Disambiguate the Chinese translation for "rebase", and update other
related entries.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
10 years agoreset: support "--mixed --intent-to-add" mode
Nguyễn Thái Ngọc Duy [Tue, 4 Feb 2014 02:20:09 +0000 (09:20 +0700)] 
reset: support "--mixed --intent-to-add" mode

When --mixed is used, entries could be removed from index if the
target ref does not have them. When "reset" is used in preparation for
commit spliting (in a dirty worktree), it could be hard to track what
files to be added back. The new option --intent-to-add simplifies it
by marking all removed files intent-to-add.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
10 years agoDocumentation: fix typos in man pages
Øystein Walle [Wed, 5 Feb 2014 22:19:43 +0000 (23:19 +0100)] 
Documentation: fix typos in man pages

Signed-off-by: Øystein Walle <oystwa@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoSync with 1.8.5.4
Junio C Hamano [Wed, 5 Feb 2014 22:14:40 +0000 (14:14 -0800)] 
Sync with 1.8.5.4

10 years agohowto/maintain-git.txt: new version numbering scheme
Junio C Hamano [Fri, 31 Jan 2014 23:14:05 +0000 (15:14 -0800)] 
howto/maintain-git.txt: new version numbering scheme

We wanted to call the upcoming release "Git 1.9", with its
maintenance track being "Git 1.9.1", "Git 1.9.2", etc., but various
third-party tools are reported to assume that there are at least
three dewey-decimal components in our version number.

Adjust the plan so that vX.Y.0 are feature releases while vX.Y.Z
(Z > 0) are maintenance releases.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoGit 1.8.5.4 v1.8.5.4
Junio C Hamano [Wed, 5 Feb 2014 22:05:31 +0000 (14:05 -0800)] 
Git 1.8.5.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'jc/maint-pull-docfix' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:03:47 +0000 (14:03 -0800)] 
Merge branch 'jc/maint-pull-docfix' into maint

The documentation to "git pull" hinted there is an "-m" option
because it incorrectly shared the documentation with "git merge".

* jc/maint-pull-docfix:
  Documentation: "git pull" does not have the "-m" option
  Documentation: exclude irrelevant options from "git pull"

10 years agoMerge branch 'ow/stash-with-ifs' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:03:20 +0000 (14:03 -0800)] 
Merge branch 'ow/stash-with-ifs' into maint

The implementation of 'git stash $cmd "stash@{...}"' did not quote
the stash argument properly and left it split at IFS whitespace.

* ow/stash-with-ifs:
  stash: handle specifying stashes with $IFS

10 years agoMerge branch 'js/lift-parent-count-limit' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:03:01 +0000 (14:03 -0800)] 
Merge branch 'js/lift-parent-count-limit' into maint

There is no reason to have a hardcoded upper limit of the number of
parents for an octopus merge, created via the graft mechanism, but
there was.

* js/lift-parent-count-limit:
  Remove the line length limit for graft files

10 years agoMerge branch 'nd/add-empty-fix' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:02:44 +0000 (14:02 -0800)] 
Merge branch 'nd/add-empty-fix' into maint

"git add -A" (no other arguments) in a totally empty working tree
used to emit an error.

* nd/add-empty-fix:
  add: don't complain when adding empty project root

10 years agoMerge branch 'bc/log-decoration' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:02:05 +0000 (14:02 -0800)] 
Merge branch 'bc/log-decoration' into maint

"git log --decorate" did not handle a tag pointed by another tag
nicely.

* bc/log-decoration:
  log: properly handle decorations with chained tags

10 years agoMerge branch 'jh/rlimit-nofile-fallback' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:01:23 +0000 (14:01 -0800)] 
Merge branch 'jh/rlimit-nofile-fallback' into maint

When we figure out how many file descriptors to allocate for
keeping packfiles open, a system with non-working getrlimit() could
cause us to die(), but because we make this call only to get a
rough estimate of how many is available and we do not even attempt
to use up all file descriptors available ourselves, it is nicer to
fall back to a reasonable low value rather than dying.

* jh/rlimit-nofile-fallback:
  get_max_fd_limit(): fall back to OPEN_MAX upon getrlimit/sysconf failure

10 years agoMerge branch 'jl/commit-v-strip-marker' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:01:09 +0000 (14:01 -0800)] 
Merge branch 'jl/commit-v-strip-marker' into maint

"git commit -v" appends the patch to the log message before
editing, and then removes the patch when the editor returned
control. However, the patch was not stripped correctly when the
first modified path was a submodule.

* jl/commit-v-strip-marker:
  commit -v: strip diffs and submodule shortlogs from the commit message

10 years agoMerge branch 'tr/send-email-ssl' into maint
Junio C Hamano [Wed, 5 Feb 2014 22:00:18 +0000 (14:00 -0800)] 
Merge branch 'tr/send-email-ssl' into maint

SSL-related options were not passed correctly to underlying socket
layer in "git send-email".

* tr/send-email-ssl:
  send-email: set SSL options through IO::Socket::SSL::set_client_defaults
  send-email: --smtp-ssl-cert-path takes an argument
  send-email: pass Debug to Net::SMTP::SSL::new

10 years agoMerge branch 'tb/clone-ssh-with-colon-for-port' into maint
Junio C Hamano [Wed, 5 Feb 2014 21:59:16 +0000 (13:59 -0800)] 
Merge branch 'tb/clone-ssh-with-colon-for-port' into maint

Remote repository URL expressed in scp-style host:path notation are
parsed more carefully (e.g. "foo/bar:baz" is local, "[::1]:/~user" asks
to connect to user's home directory on host at address ::1.

* tb/clone-ssh-with-colon-for-port:
  git_connect(): use common return point
  connect.c: refactor url parsing
  git_connect(): refactor the port handling for ssh
  git fetch: support host:/~repo
  t5500: add test cases for diag-url
  git fetch-pack: add --diag-url
  git_connect: factor out discovery of the protocol and its parts
  git_connect: remove artificial limit of a remote command
  t5601: add tests for ssh
  t5601: remove clear_ssh, refactor setup_ssh_wrapper

10 years agoMerge branch 'nd/transport-positive-depth-only' into maint
Junio C Hamano [Wed, 5 Feb 2014 21:58:51 +0000 (13:58 -0800)] 
Merge branch 'nd/transport-positive-depth-only' into maint

"git fetch --depth=0" was a no-op, and was silently ignored.
Diagnose it as an error.

* nd/transport-positive-depth-only:
  clone,fetch: catch non positive --depth option value

10 years agoMerge branch 'tb/repack-fix-renames' (early part)
Junio C Hamano [Wed, 5 Feb 2014 20:02:29 +0000 (12:02 -0800)] 
Merge branch 'tb/repack-fix-renames' (early part)

Finishing touches to the "rewrite repack in C" series.

* 'tb/repack-fix-renames' (early part):
  repack.c: rename and unlink pack file if it exists

10 years agorepack.c: rename and unlink pack file if it exists
Torsten Bögershausen [Sun, 2 Feb 2014 15:09:56 +0000 (16:09 +0100)] 
repack.c: rename and unlink pack file if it exists

When a repo was fully repacked, and is repacked again, we may run
into the situation that "new" packfiles have the same name as
already existing ones (traditionally packfiles have been named after
the list of names of objects in them, so repacking all the objects
in a single pack would have produced a packfile with the same name).

The logic is to rename the existing ones into filename like
"old-XXX", create the new ones and then remove the "old-" ones.
When something went wrong in the middle, this sequence is rolled
back by renaming the "old-" files back.

The renaming into "old-" did not work as intended, because
file_exists() was done on "XXX", not "pack-XXX".  Also when rolling
back the change, the code tried to rename "old-pack-XXX" but the
saved ones are named "old-XXX", so this couldn't have worked.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agorevision: convert to using diff_tree_sha1()
Kirill Smelkov [Wed, 5 Feb 2014 16:57:12 +0000 (20:57 +0400)] 
revision: convert to using diff_tree_sha1()

Since diff_tree_sha1() can now accept empty trees via NULL sha1, we
could just call it without manually reading trees into tree_desc and
duplicating code.

Besides, that

if (!tree)
return 0;

looked suspect - we were saying an invalid tree != empty tree, but maybe it is
better to just say the tree is invalid here, which is what diff_tree_sha1()
does for such case.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoline-log: convert to using diff_tree_sha1()
Kirill Smelkov [Wed, 5 Feb 2014 16:57:11 +0000 (20:57 +0400)] 
line-log: convert to using diff_tree_sha1()

Since diff_tree_sha1() can now accept empty trees via NULL sha1, we
could just call it without manually reading trees into tree_desc and
duplicating code.

Cc: Thomas Rast <tr@thomasrast.ch>
Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL
Kirill Smelkov [Wed, 5 Feb 2014 16:57:10 +0000 (20:57 +0400)] 
tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL

Now since diff_tree_sha1 understands NULL for both old and new, we could
indicate an empty tree for root commit by providing just NULL for old
sha1.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotree-diff: allow diff_tree_sha1 to accept NULL sha1
Kirill Smelkov [Wed, 5 Feb 2014 16:57:09 +0000 (20:57 +0400)] 
tree-diff: allow diff_tree_sha1 to accept NULL sha1

which would mean that corresponding tree - old or new - is empty.

As followup patches will show, that functionality was already needed in
several places of Git codebase, but there, we were preparing empty
tree_desc objects by hand, with some code duplication.

For handling sha1 = NULL case, let's reuse fill_tree_descriptor() which
returns just empty tree_desc in that case.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agouserdiff: update Ada patterns
Adrian Johnson [Mon, 3 Feb 2014 11:33:16 +0000 (22:03 +1030)] 
userdiff: update Ada patterns

- Allow extra space in "is new" and "is separate"
- Fix bug in word regex for numbers

Signed-off-by: Adrian Johnson <ajohnson@redneon.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosetup: don't dereference in-tree symlinks for absolute paths
Martin Erik Werner [Tue, 4 Feb 2014 14:25:20 +0000 (15:25 +0100)] 
setup: don't dereference in-tree symlinks for absolute paths

The prefix_path_gently() function currently applies real_path to
everything if given an absolute path, dereferencing symlinks both
outside and inside the work tree.

This causes most high-level functions to misbehave when acting on
symlinks given via absolute paths. For example

$ git add /dir/repo/symlink

attempts to add the target of the symlink rather than the symlink
itself, which is usually not what the user intends to do.

In order to manipulate symlinks in the work tree using absolute paths,
symlinks should only be dereferenced outside the work tree.

Modify the prefix_path_gently() to first normalize the path in order to
make sure path levels are separated by '/', then pass the result to
'abspath_part_inside_repo' to find the part inside the work tree
(without dereferencing any symlinks inside the work tree).

For absolute paths, prefix_path_gently() did not, nor does now do, any
actual prefixing, hence the result from abspath_part_in_repo() is
returned as-is.

Fixes t0060-82 and t3004-5.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosetup: add abspath_part_inside_repo() function
Martin Erik Werner [Tue, 4 Feb 2014 14:25:19 +0000 (15:25 +0100)] 
setup: add abspath_part_inside_repo() function

In order to extract the part of an absolute path which lies inside the
repo, it is not possible to directly use real_path, since that would
dereference symlinks both outside and inside the work tree.

Add an abspath_part_inside_repo() function which first checks if the
work tree is already the prefix, then incrementally checks each path
level by temporarily NUL-terminating at each '/' and comparing against
the work tree path. If a match is found, it overwrites the input path
with the remainder past the work tree (which will be the part inside the
work tree).

This function is currently only intended for use in
'prefix_path_gently'.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0060: add tests for prefix_path when path begins with work tree
Martin Erik Werner [Tue, 4 Feb 2014 14:25:18 +0000 (15:25 +0100)] 
t0060: add tests for prefix_path when path begins with work tree

One edge-case that isn't currently checked in the tests is the beginning
of the path matching the work tree, despite the target not actually
being the work tree, for example:

  path = /dir/repoa
  work_tree = /dir/repo

should fail since the path is outside the repo. However, if /dir/repoa
is in fact a symlink that points to /dir/repo, it should instead
succeed.

Add two tests covering these cases, since they might be potential
regression points.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0060: add test for prefix_path when path == work tree
Martin Erik Werner [Tue, 4 Feb 2014 14:25:17 +0000 (15:25 +0100)] 
t0060: add test for prefix_path when path == work tree

The current behaviour of prefix_path is to return an empty string if
prefixing and absolute path that only contains exactly the work tree.
This behaviour is a potential regression point.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot0060: add test for prefix_path on symlinks via absolute paths
Martin Erik Werner [Tue, 4 Feb 2014 14:25:16 +0000 (15:25 +0100)] 
t0060: add test for prefix_path on symlinks via absolute paths

When symlinks in the working tree are manipulated using the absolute
path, git dereferences them, and tries to manipulate the link target
instead.

This applies to most high-level commands but prefix_path is the common
denominator for all of them.

Add a known-breakage tests using the prefix_path function, which
currently uses real_path, causing the dereference.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot3004: add test for ls-files on symlinks via absolute paths
Junio C Hamano [Tue, 4 Feb 2014 14:25:15 +0000 (15:25 +0100)] 
t3004: add test for ls-files on symlinks via absolute paths

When symlinks in the working tree are manipulated using the absolute
path, git dereferences them, and tries to manipulate the link target
instead.

This causes most high-level functions to misbehave when acting on
symlinks given via absolute paths. For example

  $ git add /dir/repo/symlink

attempts to add the target of the symlink rather than the symlink
itself, which is usually not what the user intends to do.

This is a regression introduced by 18e051a:
  setup: translate symlinks in filename when using absolute paths
(which did not take symlinks inside the work tree into consideration).

Add a known-breakage test using the ls-files function, checking both if
the symlink leads to a target in the same directory, and a target in the
above directory.

Signed-off-by: Martin Erik Werner <martinerikwerner@gmail.com>
Tested-by: Martin Erik Werner <martinerikwerner@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agot7101, t7014: rename test files to indicate what that file is for
Nguyễn Thái Ngọc Duy [Tue, 4 Feb 2014 02:20:08 +0000 (09:20 +0700)] 
t7101, t7014: rename test files to indicate what that file is for

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-tag.txt: <commit> for --contains is optional
Nguyễn Thái Ngọc Duy [Tue, 4 Feb 2014 02:56:26 +0000 (09:56 +0700)] 
git-tag.txt: <commit> for --contains is optional

This goes far back to e84fb2f (branch --contains: default to HEAD -
2008-07-08) where the same parsing code is shared with
builtin/tag.c. git-branch.txt correctly states that <commit> for
--contains is optional while git-tag.txt does not. Correct it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agol10n: zh_CN.po: translate 1 new message (2211t0f0u)
Jiang Xin [Sun, 2 Feb 2014 12:46:58 +0000 (20:46 +0800)] 
l10n: zh_CN.po: translate 1 new message (2211t0f0u)

Update translation for git v1.9-rc2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>