git.git
12 years agoAdd missing test file for UTF-16.
Brian M. Carlson [Sat, 3 Aug 2013 17:26:31 +0000 (17:26 +0000)]
Add missing test file for UTF-16.

The test file that the UTF-16 rejection test looks for is missing, but this went
unnoticed because the test is expected to fail anyway; as a consequence, the
test fails because the file containing the commit message is missing, and not
because the test file contains a NUL byte.  Fix this by including a sample text
file containing a commit message encoded in UTF-16.

Signed-off-by: Brian M. Carlson <redacted>
Tested-by: Duy Nguyen <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agofix typo in documentation of git-svn
Felix Gruber [Sat, 3 Aug 2013 14:37:15 +0000 (16:37 +0200)]
fix typo in documentation of git-svn

Signed-off-by: Felix Gruber <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agocat-file: only split on whitespace when %(rest) is used
Jeff King [Fri, 2 Aug 2013 11:59:07 +0000 (04:59 -0700)]
cat-file: only split on whitespace when %(rest) is used

Commit c334b87b (cat-file: split --batch input lines on whitespace,
2013-07-11) taught `cat-file --batch-check` to split input lines on
the first whitespace, and stash everything after the first token
into the %(rest) output format element.  It claimed:

   Object names cannot contain spaces, so any input with
   spaces would have resulted in a "missing" line.

But that is not correct.  Refs, object sha1s, and various peeling
suffixes cannot contain spaces, but some object names can. In
particular:

  1. Tree paths like "[<tree>]:path with whitespace"

  2. Reflog specifications like "@{2 days ago}"

  3. Commit searches like "rev^{/grep me}" or ":/grep me"

To remain backwards compatible, we cannot split on whitespace by
default, hence we will ship 1.8.4 with the commit reverted.

Resurrect its attempt but in a weaker form; only do the splitting
when "%(rest)" is used in the output format. Since that element did
not exist at all before c334b87, old scripts cannot be affected.

The existence of object names with spaces does mean that you
cannot reliably do:

  echo ":path with space and other data" |
  git cat-file --batch-check="%(objectname) %(rest)"

as it would split the path and feed only ":path" to get_sha1. But
that command is nonsensical. If you wanted to see "and other data"
in "%(rest)", git cannot possibly know where the filename ends and
the "rest" begins.

It might be more robust to have something like "-z" to separate the
input elements. But this patch is still a reasonable step before
having that.  It makes the easy cases easy; people who do not care
about %(rest) do not have to consider it, and the %(rest) code
handles the spaces and newlines of "rev-list --objects" correctly.

Hard cases remain hard but possible (if you might get whitespace in
your input, you do not get to use %(rest) and must split and join
the output yourself using more flexible tools). And most
importantly, it does not preclude us from having different splitting
rules later if a "-z" (or similar) option is added.  So we can make
the hard cases easier later, if we choose to.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoDocumentation/rev-list-options: add missing word in --*-parents
Torstein Hegge [Fri, 2 Aug 2013 18:40:07 +0000 (20:40 +0200)]
Documentation/rev-list-options: add missing word in --*-parents

A commit has "parent commits" or "parents", not "commits".

Signed-off-by: Torstein Hegge <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years ago.mailmap: Multiple addresses of Michael S. Tsirkin
Stefan Beller [Sat, 3 Aug 2013 11:54:03 +0000 (13:54 +0200)]
.mailmap: Multiple addresses of Michael S. Tsirkin

Acked-by: Michael S. Tsirkin <redacted>
Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agolog: use true parents for diff when walking reflogs
Thomas Rast [Sat, 3 Aug 2013 10:36:15 +0000 (12:36 +0200)]
log: use true parents for diff when walking reflogs

The reflog walking logic (git log -g) replaces the true parent list
with the preceding commit in the reflog.  This results in bogus commit
diffs when combined with options such as -p; the diff is against the
reflog predecessor, not the parent of the commit.

Save the true parents on the side, extending the functions from the
previous commit.  The diff logic picks them up and uses them to show
the correct diffs.

We do have to be somewhat careful about repeated calling of
save_parents(), since the reflog may list a commit more than once.  We
now store (commit_list*)-1 to distinguish the "not saved yet" and
"root commit" cases.  This lets us preserve an empty parent list even
if save_parents() is repeatedly called.

Suggested-by: Jeff King <redacted>
Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agolog doc: the argument to --encoding is not optional
Jonathan Nieder [Fri, 2 Aug 2013 22:16:40 +0000 (15:16 -0700)]
log doc: the argument to --encoding is not optional

 $ git log --encoding
 fatal: Option '--encoding' requires a value
 $ git rev-list --encoding
 fatal: Option '--encoding' requires a value

The argument to --encoding has always been mandatory.  Unfortunately
manpages like git-rev-list(1), git-log(1), and git-show(1) have
described the option's syntax as "--encoding[=<encoding>]" since it
was first documented.  Clarify by removing the extra brackets.

Signed-off-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agol10n: zh_CN.po: translate 99 messages (2133t0f0u)
Jiang Xin [Fri, 26 Jul 2013 06:00:02 +0000 (14:00 +0800)]
l10n: zh_CN.po: translate 99 messages (2133t0f0u)

Translate 99 new messages came from git.pot update in 28b3cff
(l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)).

Signed-off-by: Jiang Xin <redacted>
12 years agopush: teach --force-with-lease to smart-http transport
Junio C Hamano [Fri, 2 Aug 2013 22:14:50 +0000 (15:14 -0700)]
push: teach --force-with-lease to smart-http transport

We have been passing enough information to enable the
compare-and-swap logic down to the transport layer, but the
transport helper was not passing it to smart-http transport.

Signed-off-by: Junio C Hamano <redacted>
12 years agosend-pack: fix parsing of --force-with-lease option
Junio C Hamano [Fri, 2 Aug 2013 23:06:29 +0000 (16:06 -0700)]
send-pack: fix parsing of --force-with-lease option

The last argument for parse_push_cas_option() is if it is "unset"
(i.e. --no-force-with-lease), and we are parsing the option with an
explicit value here, so it has to be 0.

Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'rj/cygwin-clarify-use-of-cheating-lstat'
Junio C Hamano [Fri, 2 Aug 2013 18:01:00 +0000 (11:01 -0700)]
Merge branch 'rj/cygwin-clarify-use-of-cheating-lstat'

Cygwin port added a "not quite correct but a lot faster and good
enough for many lstat() calls that are only used to see if the
working tree entity matches the index entry" lstat() emulation some
time ago, and it started biting us in places.  This removes it and
uses the standard lstat() that comes with Cygwin.

Recent topic that uses lstat on packed-refs file is broken when
this cheating lstat is used, and this is a simplest fix that is
also the cleanest direction to go in the long run.

* rj/cygwin-clarify-use-of-cheating-lstat:
  cygwin: Remove the Win32 l/stat() implementation

12 years agoMerge branch 'jk/cat-file-batch-optim'
Junio C Hamano [Fri, 2 Aug 2013 16:32:48 +0000 (09:32 -0700)]
Merge branch 'jk/cat-file-batch-optim'

* jk/cat-file-batch-optim:
  Revert "cat-file: split --batch input lines on whitespace"

12 years agoRevert "cat-file: split --batch input lines on whitespace"
Junio C Hamano [Fri, 2 Aug 2013 16:29:30 +0000 (09:29 -0700)]
Revert "cat-file: split --batch input lines on whitespace"

This reverts commit c334b87b30c1464a1ab563fe1fb8de5eaf0e5bac; the
update assumed that people only used the command to read from
"rev-list --objects" output, whose lines begin with a 40-hex object
name followed by a whitespace, but it turns out that scripts feed
random extended SHA-1 expressions (e.g. "HEAD:$pathname") in which
a whitespace has to be kept.

12 years agoDon't close pack fd when free'ing pack windows
Brandon Casey [Wed, 31 Jul 2013 19:51:37 +0000 (12:51 -0700)]
Don't close pack fd when free'ing pack windows

Now that close_one_pack() has been introduced to handle file
descriptor pressure, it is not strictly necessary to close the
pack file descriptor in unuse_one_window() when we're under memory
pressure.

Jeff King provided a justification for leaving the pack file open:

   If you close packfile descriptors, you can run into racy situations
   where somebody else is repacking and deleting packs, and they go away
   while you are trying to access them. If you keep a descriptor open,
   you're fine; they last to the end of the process. If you don't, then
   they disappear from under you.

   For normal object access, this isn't that big a deal; we just rescan
   the packs and retry. But if you are packing yourself (e.g., because
   you are a pack-objects started by upload-pack for a clone or fetch),
   it's much harder to recover (and we print some warnings).

Let's do so (or uh, not do so).

Signed-off-by: Brandon Casey <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agosha1_file: introduce close_one_pack() to close packs on fd pressure
Brandon Casey [Fri, 2 Aug 2013 05:36:33 +0000 (22:36 -0700)]
sha1_file: introduce close_one_pack() to close packs on fd pressure

When the number of open packs exceeds pack_max_fds, unuse_one_window()
is called repeatedly to attempt to release the least-recently-used
pack windows, which, as a side-effect, will also close a pack file
after closing its last open window.  If a pack file has been opened,
but no windows have been allocated into it, it will never be selected
by unuse_one_window() and hence its file descriptor will not be
closed.  When this happens, git may exceed the number of file
descriptors permitted by the system.

This latter situation can occur in show-ref or receive-pack during ref
advertisement.  During ref advertisement, receive-pack will iterate
over every ref in the repository and advertise it to the client after
ensuring that the ref exists in the local repository.  If the ref is
located inside a pack, then the pack is opened to ensure that it
exists, but since the object is not actually read from the pack, no
mmap windows are allocated.  When the number of open packs exceeds
pack_max_fds, unuse_one_window() will not be able to find any windows to
free and will not be able to close any packs.  Once the per-process
file descriptor limit is exceeded, receive-pack will produce a warning,
not an error, for each pack it cannot open, and will then most likely
fail with an error to spawn rev-list or index-pack like:

   error: cannot create standard input pipe for rev-list: Too many open files
   error: Could not run 'git rev-list'

This may also occur during upload-pack when refs are packed (in the
packed-refs file) and the number of packs that must be opened to
verify that these packed refs exist exceeds the file descriptor
limit.  If the refs are loose, then upload-pack will read each ref
from the object database (if the object is in a pack, allocating one
or more mmap windows for it) in order to peel tags and advertise the
underlying object.  But when the refs are packed and peeled,
upload-pack will use the peeled sha1 in the packed-refs file and
will not need to read from the pack files, so no mmap windows will
be allocated and just like with receive-pack, unuse_one_window()
will never select these opened packs to close.

When we have file descriptor pressure, we just need to find an open
pack to close.  We can leave the existing mmap windows open.  If
additional windows need to be mapped into the pack file, it will be
reopened when necessary.  If the pack file has been rewritten in the
mean time, open_packed_git_1() should notice when it compares the file
size or the pack's sha1 checksum to what was previously read from the
pack index, and reject it.

Let's introduce a new function close_one_pack() designed specifically
for this purpose to search for and close the least-recently-used pack,
where LRU is defined as (in order of preference):

   * pack with oldest mtime and no allocated mmap windows
   * pack with the least-recently-used windows, i.e. the pack
     with the oldest most-recently-used window, where none of
     the windows are in use
   * pack with the least-recently-used windows

Signed-off-by: Brandon Casey <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoProvide some linguistic guidance for the documentation.
Marc Branchaud [Thu, 1 Aug 2013 18:49:54 +0000 (14:49 -0400)]
Provide some linguistic guidance for the documentation.

This will hopefully avoid questions over which spelling and grammar should
be used.  Translators are of course free to create localizations for
specific English dialects.

Signed-off-by: Marc Branchaud <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoGit 1.8.4-rc1
Junio C Hamano [Thu, 1 Aug 2013 19:01:53 +0000 (12:01 -0700)]
Git 1.8.4-rc1

Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'ob/typofixes'
Junio C Hamano [Thu, 1 Aug 2013 18:58:32 +0000 (11:58 -0700)]
Merge branch 'ob/typofixes'

* ob/typofixes:
  many small typofixes

12 years agoMerge branch 'ms/subtree-install-fix'
Junio C Hamano [Thu, 1 Aug 2013 18:57:25 +0000 (11:57 -0700)]
Merge branch 'ms/subtree-install-fix'

* ms/subtree-install-fix:
  contrib/subtree: Fix make install target

12 years agoMerge branch 'jc/rm-submodule-error-message'
Junio C Hamano [Thu, 1 Aug 2013 18:57:25 +0000 (11:57 -0700)]
Merge branch 'jc/rm-submodule-error-message'

Consolidate two messages phrased subtly differently without a good
reason.

* jc/rm-submodule-error-message:
  builtin/rm.c: consolidate error reporting for removing submodules

12 years agoMerge branch 'lf/echo-n-is-not-portable'
Junio C Hamano [Thu, 1 Aug 2013 18:52:43 +0000 (11:52 -0700)]
Merge branch 'lf/echo-n-is-not-portable'

* lf/echo-n-is-not-portable:
  Avoid using `echo -n` anywhere

12 years agoMerge branch 'ma/hg-to-git'
Junio C Hamano [Thu, 1 Aug 2013 18:52:40 +0000 (11:52 -0700)]
Merge branch 'ma/hg-to-git'

* ma/hg-to-git:
  hg-to-git: --allow-empty-message in git commit

12 years agoMerge branch 'jx/clean-interactive'
Junio C Hamano [Thu, 1 Aug 2013 18:52:37 +0000 (11:52 -0700)]
Merge branch 'jx/clean-interactive'

* jx/clean-interactive:
  git-clean: implement partial matching for selection
  Documentation/git-clean: fix description for range

12 years agot5540/5541: smart-http does not support "--force-with-lease"
Junio C Hamano [Thu, 1 Aug 2013 18:05:02 +0000 (11:05 -0700)]
t5540/5541: smart-http does not support "--force-with-lease"

The push() method in remote-curl.c is not told and does not pass the
necessary information to underlying send-pack, so this extension
does not yet work.  Leave a note in the test suite.

Signed-off-by: Junio C Hamano <redacted>
12 years agolog: use true parents for diff even when rewriting
Thomas Rast [Wed, 31 Jul 2013 20:13:20 +0000 (22:13 +0200)]
log: use true parents for diff even when rewriting

When using pathspec filtering in combination with diff-based log
output, parent simplification happens before the diff is computed.
The diff is therefore against the *simplified* parents.

This works okay, arguably by accident, in the normal case:
simplification reduces to one parent as long as the commit is TREESAME
to it.  So the simplified parent of any given commit must have the
same tree contents on the filtered paths as its true (unfiltered)
parent.

However, --full-diff breaks this guarantee, and indeed gives pretty
spectacular results when comparing the output of

  git log --graph --stat ...
  git log --graph --full-diff --stat ...

(--graph internally kicks in parent simplification, much like
--parents).

To fix it, store a copy of the parent list before simplification (in a
slab) whenever --full-diff is in effect.  Then use the stored parents
instead of the simplified ones in the commit display code paths.  The
latter do not actually check for --full-diff to avoid duplicated code;
they just grab the original parents if save_parents() has not been
called for this revision walk.

For ordinary commits it should be obvious that this is the right thing
to do.

Merge commits are a bit subtle.  Observe that with default
simplification, merge simplification is an all-or-nothing decision:
either the merge is TREESAME to one parent and disappears, or it is
different from all parents and the parent list remains intact.
Redundant parents are not pruned, so the existing code also shows them
as a merge.

So if we do show a merge commit, the parent list just consists of the
rewrite result on each parent.  Running, e.g., --cc on this in
--full-diff mode is not very useful: if any commits were skipped, some
hunks will disagree with all sides of the merge (with one side,
because commits were skipped; with the others, because they didn't
have those changes in the first place).  This triggers --cc showing
these hunks spuriously.

Therefore I believe that even for merge commits it is better to show
the diffs wrt. the original parents.

Reported-by: Uwe Kleine-König <redacted>
Helped-by: Junio C Hamano <redacted>
Helped-by: Ramsay Jones <redacted>
Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoRename advice.object_name_warning to objectNameWarning
Thomas Rast [Wed, 31 Jul 2013 20:23:31 +0000 (22:23 +0200)]
Rename advice.object_name_warning to objectNameWarning

We spell config variables in camelCase instead of with_underscores.

Signed-off-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoconfig: add generic callback wrapper to parse section.<url>.key
Junio C Hamano [Wed, 31 Jul 2013 17:42:01 +0000 (10:42 -0700)]
config: add generic callback wrapper to parse section.<url>.key

Existing configuration parsing functions (e.g. http_options() in
http.c) know how to parse two-level configuration variable names.
We would like to exploit them and parse something like this:

[http]
sslVerify = true
[http "https://weak.example.com"]
sslVerify = false

and pretend as if http.sslVerify were set to false when talking to
"https://weak.example.com/path".

Introduce `urlmatch_config_entry()` wrapper that:

 - is called with the target URL (e.g. "https://weak.example.com/path"),
   and the two-level variable parser (e.g. `http_options`);

 - uses `url_normalize()` and `match_urls()` to see if configuration
   data matches the target URL; and

 - calls the traditional two-level configuration variable parser
   only for the configuration data whose <url> part matches the
   target URL (and if there are multiple matches, only do so if the
   current match is a better match than the ones previously seen).

Signed-off-by: Junio C Hamano <redacted>
12 years agoconfig: add helper to normalize and match URLs
Kyle J. McKay [Wed, 31 Jul 2013 20:52:00 +0000 (13:52 -0700)]
config: add helper to normalize and match URLs

Some http.* configuration variables need to take values customized
for the URL we are talking to.  We may want to set http.sslVerify to
true in general but to false only for a certain site, for example,
with a configuration file like this:

[http]
sslVerify = true
[http "https://weak.example.com"]
sslVerify = false

and let the configuration machinery pick up the latter only when
talking to "https://weak.example.com".  The latter needs to kick in
not only when the URL is exactly "https://weak.example.com", but
also is anything that "match" it, e.g.

https://weak.example.com/test
https://me@weak.example.com/test

The <url> in the configuration key consists of the following parts,
and is considered a match to the URL we are attempting to access
under certain conditions:

  . Scheme (e.g., `https` in `https://example.com/`). This field
    must match exactly between the config key and the URL.

  . Host/domain name (e.g., `example.com` in `https://example.com/`).
    This field must match exactly between the config key and the URL.

  . Port number (e.g., `8080` in `http://example.com:8080/`).  This
    field must match exactly between the config key and the URL.
    Omitted port numbers are automatically converted to the correct
    default for the scheme before matching.

  . Path (e.g., `repo.git` in `https://example.com/repo.git`). The
    path field of the config key must match the path field of the
    URL either exactly or as a prefix of slash-delimited path
    elements.  A config key with path `foo/` matches URL path
    `foo/bar`.  A prefix can only match on a slash (`/`) boundary.
    Longer matches take precedence (so a config key with path
    `foo/bar` is a better match to URL path `foo/bar` than a config
    key with just path `foo/`).

  . User name (e.g., `me` in `https://me@example.com/repo.git`). If
    the config key has a user name, it must match the user name in
    the URL exactly. If the config key does not have a user name,
    that config key will match a URL with any user name (including
    none), but at a lower precedence than a config key with a user
    name.

Longer matches take precedence over shorter matches.

This step adds two helper functions `url_normalize()` and
`match_urls()` to help implement the above semantics. The
normalization rules are based on RFC 3986 and should result in any
two equivalent urls being a match.

Signed-off-by: Kyle J. McKay <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'rr/rebase-autostash'
Junio C Hamano [Wed, 31 Jul 2013 19:38:29 +0000 (12:38 -0700)]
Merge branch 'rr/rebase-autostash'

* rr/rebase-autostash:
  git-rebase: fix typo

12 years agoMerge branch 'rj/commit-slab-fix'
Junio C Hamano [Wed, 31 Jul 2013 19:38:27 +0000 (12:38 -0700)]
Merge branch 'rj/commit-slab-fix'

* rj/commit-slab-fix:
  commit-slab.h: Fix memory allocation and addressing

12 years agoMerge branch 'jk/commit-how-to-abort-cherry-pick'
Junio C Hamano [Wed, 31 Jul 2013 19:38:23 +0000 (12:38 -0700)]
Merge branch 'jk/commit-how-to-abort-cherry-pick'

* jk/commit-how-to-abort-cherry-pick:
  commit: tweak empty cherry pick advice for sequencer

12 years agoMerge branch 'ds/doc-two-kinds-of-tags'
Junio C Hamano [Wed, 31 Jul 2013 19:38:21 +0000 (12:38 -0700)]
Merge branch 'ds/doc-two-kinds-of-tags'

* ds/doc-two-kinds-of-tags:
  docs/git-tag: explain lightweight versus annotated tags

12 years agoMerge branch 'rr/maint-tilde-markup-in-doc'
Junio C Hamano [Wed, 31 Jul 2013 19:38:15 +0000 (12:38 -0700)]
Merge branch 'rr/maint-tilde-markup-in-doc'

* rr/maint-tilde-markup-in-doc:
  config doc: quote paths, fixing tilde-interpretation

12 years agoMerge branch 'mh/packed-refs-do-one-ref-recursion'
Junio C Hamano [Wed, 31 Jul 2013 19:38:11 +0000 (12:38 -0700)]
Merge branch 'mh/packed-refs-do-one-ref-recursion'

Fix a NULL-pointer dereference during nested iterations over
references (for example, when replace references are being used).

* mh/packed-refs-do-one-ref-recursion:
  do_one_ref(): save and restore value of current_ref

12 years agohttp.c: fix parsing of http.sslCertPasswordProtected variable
Junio C Hamano [Fri, 12 Jul 2013 18:52:47 +0000 (11:52 -0700)]
http.c: fix parsing of http.sslCertPasswordProtected variable

The existing code triggers only when the configuration variable is
set to true.  Once the variable is set to true in a more generic
configuration file (e.g. ~/.gitconfig), it cannot be overriden to
false in the repository specific one (e.g. .git/config).

Signed-off-by: Junio C Hamano <redacted>
12 years agosubmodule.c: add .gitmodules staging helper functions
Jens Lehmann [Tue, 30 Jul 2013 19:50:34 +0000 (21:50 +0200)]
submodule.c: add .gitmodules staging helper functions

Add the new is_staging_gitmodules_ok() and stage_updated_gitmodules()
functions to submodule.c. The first makes it possible for call sites to
see if the .gitmodules file did contain any unstaged modifications they
would accidentally stage in addition to those they intend to stage
themselves. The second function stages all modifications to the
.gitmodules file, both will be used by subsequent patches for the mv
and rm commands.

Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agomv: move submodules using a gitfile
Jens Lehmann [Tue, 30 Jul 2013 19:50:03 +0000 (21:50 +0200)]
mv: move submodules using a gitfile

When moving a submodule which uses a gitfile to point to the git directory
stored in .git/modules/<name> of the superproject two changes must be made
to make the submodule work: the .git file and the core.worktree setting
must be adjusted to point from work tree to git directory and back.

Achieve that by remembering which submodule uses a gitfile by storing the
result of read_gitfile() of each submodule. If that is not NULL the new
function connect_work_tree_and_git_dir() is called after renaming the
submodule's work tree which updates the two settings to the new values.

Extend the man page to inform the user about that feature (and while at it
change the description to not talk about a script anymore, as mv is a
builtin for quite some time now).

Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agomv: move submodules together with their work trees
Jens Lehmann [Tue, 30 Jul 2013 19:49:25 +0000 (21:49 +0200)]
mv: move submodules together with their work trees

Currently the attempt to use "git mv" on a submodule errors out with:

  fatal: source directory is empty, source=<src>, destination=<dest>

The reason is that mv searches for the submodule with a trailing slash in
the index, which it doesn't find (because it is stored without a trailing
slash). As it doesn't find any index entries inside the submodule it
claims the directory would be empty even though it isn't.

Fix that by searching for the name without a trailing slash and continue
if it is a submodule. Then rename() will move the submodule work tree just
like it moves a file.

Signed-off-by: Jens Lehmann <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotag: use OPT_CMDMODE
Junio C Hamano [Tue, 30 Jul 2013 19:31:27 +0000 (12:31 -0700)]
tag: use OPT_CMDMODE

This is just a demonstration of how the code would look like; I do
not think it is particularly easier to read than before myself.

Signed-off-by: Junio C Hamano <redacted>
12 years agoparse-options: add OPT_CMDMODE()
Junio C Hamano [Tue, 30 Jul 2013 19:06:01 +0000 (12:06 -0700)]
parse-options: add OPT_CMDMODE()

This can be used to define a set of mutually exclusive "command
mode" options, and automatically catch use of more than one from
that set as an error.

Signed-off-by: Junio C Hamano <redacted>
12 years agohttp: add http.savecookies option to write out HTTP cookies
Dave Borowitz [Tue, 23 Jul 2013 22:40:17 +0000 (15:40 -0700)]
http: add http.savecookies option to write out HTTP cookies

HTTP servers may send Set-Cookie headers in a response and expect them
to be set on subsequent requests. By default, libcurl behavior is to
store such cookies in memory and reuse them across requests within a
single session. However, it may also make sense, depending on the
server and the cookies, to store them across sessions. Provide users
an option to enable this behavior, writing cookies out to the same
file specified in http.cookiefile.

Signed-off-by: Dave Borowitz <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'jk/capabilities-doc'
Junio C Hamano [Tue, 30 Jul 2013 16:16:42 +0000 (09:16 -0700)]
Merge branch 'jk/capabilities-doc'

* jk/capabilities-doc:
  document 'allow-tip-sha1-in-want' capability
  document 'quiet' receive-pack capability
  document 'agent' protocol capability
  docs: note that receive-pack knows side-band-64k capability
  docs: fix 'report-status' protocol capability thinko

12 years agoMerge branch 'sb/mailmap-updates'
Junio C Hamano [Tue, 30 Jul 2013 16:16:39 +0000 (09:16 -0700)]
Merge branch 'sb/mailmap-updates'

* sb/mailmap-updates:
  .mailmap: combine more (email, name) to individual persons

12 years agoMerge branch 'bc/completion-for-bash-3.0'
Junio C Hamano [Tue, 30 Jul 2013 16:16:36 +0000 (09:16 -0700)]
Merge branch 'bc/completion-for-bash-3.0'

* bc/completion-for-bash-3.0:
  git-completion.bash: replace zsh notation that breaks bash 3.X

12 years agoimap-send: use Apple's Security framework for base64 encoding
Jeremy Huddleston [Tue, 30 Jul 2013 01:28:30 +0000 (18:28 -0700)]
imap-send: use Apple's Security framework for base64 encoding

Use Apple's supported functions for base64 encoding instead
of the deprecated OpenSSL functions.

Signed-off-by: Jeremy Huddleston <redacted>
Signed-off-by: David Aguilar <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoquote: remove sq_quote_print()
Ramkumar Ramachandra [Tue, 30 Jul 2013 08:31:27 +0000 (14:01 +0530)]
quote: remove sq_quote_print()

Remove sq_quote_print() since it has no callers.

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agotar-tree: remove dependency on sq_quote_print()
Ramkumar Ramachandra [Tue, 30 Jul 2013 08:31:26 +0000 (14:01 +0530)]
tar-tree: remove dependency on sq_quote_print()

By rewriting the loop that formats the argv[] in cmd_tar_tree()
function using sq_quote_argv() for code simplicity, the last use of
sq_quote_print() goes away.

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agofor-each-ref, quote: convert *_quote_print -> *_quote_buf
Nguyễn Thái Ngọc Duy [Tue, 30 Jul 2013 08:31:25 +0000 (14:01 +0530)]
for-each-ref, quote: convert *_quote_print -> *_quote_buf

The print_value() function in for-each-ref.c prints values to stdout
immediately using {sq|perl|python|tcl}_quote_print().  Change these
lower-level quote functions to instead leave their results in strbuf
so that we can later add post-processing to the results of them.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agocontrib/subtree: Fix make install target
Michal Sojka [Tue, 30 Jul 2013 08:16:09 +0000 (10:16 +0200)]
contrib/subtree: Fix make install target

If the libexec directory doesn't exist, git-subtree gets installed as
$prefix/share/libexec/git-core file. This patch creates the directory
before installing git-subtree file into it.

Signed-off-by: Michal Sojka <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agomany small typofixes
Ondřej Bílka [Mon, 29 Jul 2013 08:18:21 +0000 (10:18 +0200)]
many small typofixes

Signed-off-by: Ondřej Bílka <redacted>
Reviewed-by: Marc Branchaud <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoeditor: use canonicalized absolute path
Ramkumar Ramachandra [Sun, 28 Jul 2013 16:59:42 +0000 (22:29 +0530)]
editor: use canonicalized absolute path

By improving the relative_path() algorithm, e02ca72 (path.c:
refactor relative_path(), not only strip prefix, 2013-06-25)
uncovered a latent bug in Emacs.  While most editor applications
like cat and vim handle non-canonicalized relative paths fine, emacs
does not.  This is due to a long-standing bug in emacs, where it
refuses to resolve symlinks in the supplied path:

  #!/bin/sh
  cd /tmp
  mkdir z z/a z/b
  echo moodle >z/a/file
  ln -s z/b
  cd b
  emacs ../a/file # fail: attempts to open /tmp/a/file

Even if emacs were to be patched to fix this bug, it may be nicer to
help users running older versions.

Note that this can potentially regress for users of all editors,
when they ask "what file am I editing?" to the editor, as it is
likely to answer with an unsightly long full path.

Co-authored-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agogit-rebase: fix typo
Ralf Thielow [Mon, 29 Jul 2013 04:24:43 +0000 (06:24 +0200)]
git-rebase: fix typo

Signed-off-by: Ralf Thielow <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoAvoid using `echo -n` anywhere
Lukas Fleischer [Sat, 27 Jul 2013 12:11:33 +0000 (14:11 +0200)]
Avoid using `echo -n` anywhere

`echo -n` is non-portable. The POSIX specification says:

    Conforming applications that wish to do prompting without <newline>
    characters or that could possibly be expecting to echo a -n, should
    use the printf utility derived from the Ninth Edition system.

Since all of the affected shell scripts use a POSIX shell shebang,
replace `echo -n` invocations with printf.

Signed-off-by: Lukas Fleischer <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agocommit-slab.h: Fix memory allocation and addressing
Ramsay Jones [Sat, 27 Jul 2013 19:00:07 +0000 (20:00 +0100)]
commit-slab.h: Fix memory allocation and addressing

The slab initialization code includes the calculation of the
slab 'elem_size', which is in turn used to determine the size
(capacity) of the slab. Each element of the slab represents an
array, of length 'stride', of 'elemtype'. (Note that it may be
clearer if the define_commit_slab macro parameter was called
'basetype' rather than 'elemtype'). However, the 'elem_size'
calculation incorrectly uses 'sizeof(struct slabname)' in the
expression, rather than 'sizeof(elemtype)'.

Within the slab access routine, <slabname>_at(), the given commit
'index' is transformed into an (slab#, slot#) pair used to address
the required element (a pointer to the first element of the array
of 'elemtype' associated with that commit). The current code to
calculate these address coordinates multiplies the commit index
by the 'stride' which, at least for the slab#, produces the wrong
result. Using the commit index directly, without scaling by the
'stride', produces the correct 'logical' address.

Also, when allocating a new slab, the size of the allocation only
allows for a slab containing elements of single element arrays of
'elemtype'. This should allow for elements of an array of length
'stride' of 'elemtype'. In order to fix this, we need to change
the element size parameter to xcalloc() by multiplying the current
element size (sizeof(**s->slab)) by the s->stride.

Having changed the calculation of the slot#, we now need to convert
the logical 'nth_slot', by scaling with s->stride, into the correct
physical address.

Signed-off-by: Ramsay Jones <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agocommit: tweak empty cherry pick advice for sequencer
Jeff King [Fri, 26 Jul 2013 23:39:28 +0000 (19:39 -0400)]
commit: tweak empty cherry pick advice for sequencer

When we refuse to make an empty commit, we check whether we
are in a cherry-pick in order to give better advice on how
to proceed. We instruct the user to repeat the commit with
"--allow-empty" to force the commit, or to use "git reset"
to skip it and abort the cherry-pick.

In the case of a single cherry-pick, the distinction between
skipping and aborting is not important, as there is no more
work to be done afterwards.  When we are using the sequencer
to cherry pick a series of commits, though, the instruction
is confusing: does it skip this commit, or does it abort the
rest of the cherry-pick?

It does skip, after which the user can continue the
cherry-pick. This is the right thing to be advising the user
to do, but let's make it more clear what will happen, both
by using the word "skip", and by mentioning that the rest of
the sequence can be continued via "cherry-pick --continue"
(whether we skip or take the commit).

Noticed-by: Ramkumar Ramachandra <redacted>
Helped-by: Jonathan Nieder <redacted>
Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocs/git-tag: explain lightweight versus annotated tags
Daniele Segato [Fri, 26 Jul 2013 19:06:02 +0000 (15:06 -0400)]
docs/git-tag: explain lightweight versus annotated tags

Stress the difference between the two with a suggestion on
when the user should use one in place of the other.

Signed-off-by: Daniele Segato <redacted>
Signed-off-by: Jeff King <redacted>
Reviewed-by: Jonathan Nieder <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agol10n: vi.po (2133t)
Tran Ngoc Quan [Sat, 27 Jul 2013 01:46:06 +0000 (08:46 +0700)]
l10n: vi.po (2133t)

Signed-off-by: Tran Ngoc Quan <redacted>
12 years agoconfig doc: quote paths, fixing tilde-interpretation
Ramkumar Ramachandra [Fri, 26 Jul 2013 10:42:02 +0000 (16:12 +0530)]
config doc: quote paths, fixing tilde-interpretation

The --global section of git-config(1) currently reads like:

  For writing options: write to global /.gitconfig file rather than the
                                       ^
       start tilde

  repository .git/config, write to $XDG_CONFIG_HOME/git/config file if
  this file exists and the/.gitconfig file doesn’t.
                          ^
  end tilde

Instead of tilde (~) being interpreted literally, asciidoc subscripts
the text between the two tildes.  To fix this problem, use backticks (`)
to quote all the paths in the file uniformly, just like config.txt does.

Signed-off-by: Ramkumar Ramachandra <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocument 'allow-tip-sha1-in-want' capability
Nguyễn Thái Ngọc Duy [Fri, 26 Jul 2013 11:01:54 +0000 (18:01 +0700)]
document 'allow-tip-sha1-in-want' capability

See 390eb36 (upload-pack: optionally allow fetching from the tips of
hidden refs - 2013-01-28) for more information.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agol10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)
Jiang Xin [Fri, 26 Jul 2013 00:56:45 +0000 (08:56 +0800)]
l10n: git.pot: v1.8.4 round 1 (99 new, 46 removed)

Generate po/git.pot from v1.8.4-rc0 for git v1.8.4 l10n round 1.

Signed-off-by: Jiang Xin <redacted>
12 years agobuiltin/rm.c: consolidate error reporting for removing submodules
Junio C Hamano [Fri, 26 Jul 2013 06:05:17 +0000 (23:05 -0700)]
builtin/rm.c: consolidate error reporting for removing submodules

We have two (not identical) copies of error reporting when
attempting to remove submodules that have their repositories
embedded within them.  Add a helper function so that we do not have
to repeat similar error messages with subtly different wording
without a good reason.

Noticed by Jiang Xin.

Signed-off-by: Junio C Hamano <redacted>
12 years agocommit.h: drop redundant comment
Jeff King [Thu, 25 Jul 2013 20:01:00 +0000 (16:01 -0400)]
commit.h: drop redundant comment

We mention twice that the from_ident field of struct
pretty_print_context is internal.

The first comment was added by 10f2fbf, which prepares the
struct for internal fields, and then the second by a908047,
which actually adds such a field. This was a mistake made
when re-rolling the series on the list; the comment should
have been removed from the latter commit.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoGit 1.8.4-rc0
Junio C Hamano [Thu, 25 Jul 2013 02:29:07 +0000 (19:29 -0700)]
Git 1.8.4-rc0

Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'mh/multimail'
Junio C Hamano [Thu, 25 Jul 2013 02:23:03 +0000 (19:23 -0700)]
Merge branch 'mh/multimail'

An enhanced "post-receive" hook to send e-mail messages.

* mh/multimail:
  post-receive-email: deprecate script in favor of git-multimail
  git-multimail: an improved replacement for post-receive-email

12 years agoMerge branch 'ob/typofixes'
Junio C Hamano [Thu, 25 Jul 2013 02:23:00 +0000 (19:23 -0700)]
Merge branch 'ob/typofixes'

* ob/typofixes:
  typofix: in-code comments
  typofix: documentation
  typofix: release notes

12 years agoMerge branch 'es/contacts'
Junio C Hamano [Thu, 25 Jul 2013 02:22:57 +0000 (19:22 -0700)]
Merge branch 'es/contacts'

A helper to read from a set of format-patch output files or a range
of commits and find those who may have insights to the code that
the changes touch by running a series of "git blame" commands.

* es/contacts:
  contrib: contacts: add documentation
  contrib: contacts: add mailmap support
  contrib: contacts: interpret committish akin to format-patch
  contrib: contacts: add ability to parse from committish
  contrib: add git-contacts helper

12 years agoMerge branch 'ml/cygwin-updates'
Junio C Hamano [Thu, 25 Jul 2013 02:22:49 +0000 (19:22 -0700)]
Merge branch 'ml/cygwin-updates'

The tip one does _not_ revert c869753e (Force core.filemode to
false on Cygwin., 2006-12-30) on purpose, so that people can
still retain the old behaviour if they wanted to.

* ml/cygwin-updates:
  cygwin: stop forcing core.filemode=false
  Cygwin 1.7 supports mmap
  Cygwin 1.7 has thread-safe pread
  Cygwin 1.7 needs compat/regex

12 years agoMerge branch 'rj/sparse'
Junio C Hamano [Thu, 25 Jul 2013 02:21:30 +0000 (19:21 -0700)]
Merge branch 'rj/sparse'

* rj/sparse:
  Revert "compat/unsetenv.c: Fix a sparse warning"

12 years agoMerge branch 'sb/traverse-trees-bitmask-variable-name'
Junio C Hamano [Thu, 25 Jul 2013 02:21:25 +0000 (19:21 -0700)]
Merge branch 'sb/traverse-trees-bitmask-variable-name'

* sb/traverse-trees-bitmask-variable-name:
  traverse_trees(): clarify return value of the callback

12 years agoMerge branch 'jk/cat-file-batch-optim'
Junio C Hamano [Thu, 25 Jul 2013 02:21:21 +0000 (19:21 -0700)]
Merge branch 'jk/cat-file-batch-optim'

If somebody wants to only know on-disk footprint of an object
without having to know its type or payload size, we can bypass a
lot of code to cheaply learn it.

* jk/cat-file-batch-optim:
  Fix some sparse warnings
  sha1_object_info_extended: pass object_info to helpers
  sha1_object_info_extended: make type calculation optional
  packed_object_info: make type lookup optional
  packed_object_info: hoist delta type resolution to helper
  sha1_loose_object_info: make type lookup optional
  sha1_object_info_extended: rename "status" to "type"
  cat-file: disable object/refname ambiguity check for batch mode

12 years agoMerge branch 'ml/avoid-using-grep-on-crlf-files'
Junio C Hamano [Thu, 25 Jul 2013 02:21:18 +0000 (19:21 -0700)]
Merge branch 'ml/avoid-using-grep-on-crlf-files'

On systems that understand a CRLF as a line ending, tests in this
script that worked on files with CRLF line endings using "grep" to
extract matching lines may lose the CR at the end of lines that
match, causing the actual output not to match the expected output.

* ml/avoid-using-grep-on-crlf-files:
  test-lib.sh - define and use GREP_STRIPS_CR

12 years agoMerge branch 'jm/doc-ref-prune'
Junio C Hamano [Thu, 25 Jul 2013 02:21:15 +0000 (19:21 -0700)]
Merge branch 'jm/doc-ref-prune'

* jm/doc-ref-prune:
  Documentation: fix git-prune example usage
  Documentation: remove --prune from pack-refs examples

12 years agoMerge branch 'rh/template-updates'
Junio C Hamano [Thu, 25 Jul 2013 02:21:07 +0000 (19:21 -0700)]
Merge branch 'rh/template-updates'

* rh/template-updates:
  templates: spell ASCII in uppercase in pre-commit hook
  templates: Reformat pre-commit hook's message
  templates: Use heredoc in pre-commit hook

12 years agoMerge branch 'mh/ref-races-optim-invalidate-cached'
Junio C Hamano [Thu, 25 Jul 2013 02:21:02 +0000 (19:21 -0700)]
Merge branch 'mh/ref-races-optim-invalidate-cached'

* mh/ref-races-optim-invalidate-cached:
  refs: do not invalidate the packed-refs cache unnecessarily

12 years agoMerge branch 'sb/misc-fixes'
Junio C Hamano [Thu, 25 Jul 2013 02:20:58 +0000 (19:20 -0700)]
Merge branch 'sb/misc-fixes'

Assorted code cleanups and a minor fix.

* sb/misc-fixes:
  diff.c: Do not initialize a variable, which gets reassigned anyway.
  commit: Fix a memory leak in determine_author_info
  daemon.c:handle: Remove unneeded check for null pointer.

12 years agoMerge branch 'tr/line-log'
Junio C Hamano [Thu, 25 Jul 2013 02:19:24 +0000 (19:19 -0700)]
Merge branch 'tr/line-log'

Fix "log -L" command line parsing bugs.

* tr/line-log:
  t4211: fix incorrect rebase at f8395edc (range-set: satisfy non-empty ranges invariant)
  line-log: fix "log -LN" crash when N is last line of file
  range-set: satisfy non-empty ranges invariant
  t4211: demonstrate crash when first -L encountered is empty range
  t4211: demonstrate empty -L range crash
  range-set: fix sort_and_merge_range_set() corner case bug

12 years agogit-clean: implement partial matching for selection
Jiang Xin [Wed, 24 Jul 2013 02:22:04 +0000 (10:22 +0800)]
git-clean: implement partial matching for selection

Document for interactive git-clean says: "You also could say `c` or
`clean` above as long as the choice is unique". But it's not true,
because only hotkey `c` and full match (`clean`) could work.

Implement partial matching via find_unique function to make the
document right.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoDocumentation/git-clean: fix description for range
Jiang Xin [Tue, 23 Jul 2013 22:22:43 +0000 (06:22 +0800)]
Documentation/git-clean: fix description for range

The descriptions of "select by numbers" section for interactive
git-clean are borrowed from git-add, and one sentence should be
replaced.

Signed-off-by: Jiang Xin <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years ago.mailmap: combine more (email, name) to individual persons
Stefan Beller [Wed, 24 Jul 2013 17:55:18 +0000 (19:55 +0200)]
.mailmap: combine more (email, name) to individual persons

I got more responses from people regarding the .mailmap file.
All added persons gave permission to add them to the .mailmap file.

Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocument 'quiet' receive-pack capability
Jeff King [Wed, 24 Jul 2013 08:03:43 +0000 (04:03 -0400)]
document 'quiet' receive-pack capability

This was added in c207e34 (fix push --quiet: add 'quiet'
capability to receive-pack, 2012-01-08) but never
documented.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocument 'agent' protocol capability
Jeff King [Wed, 24 Jul 2013 08:03:13 +0000 (04:03 -0400)]
document 'agent' protocol capability

This was added in ff5effd (include agent identifier in
capability string, 2012-08-03), but neither the syntax nor
the semantics were ever documented outside of the commit
message.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocs: note that receive-pack knows side-band-64k capability
Jeff King [Wed, 24 Jul 2013 08:01:59 +0000 (04:01 -0400)]
docs: note that receive-pack knows side-band-64k capability

The protocol-capabilities documentation notes that any
capabilities not explicitly mentioned for receive-pack work
only for upload-pack.

Receive-pack has advertised and understood side-band-64k
since 38a81b4 (receive-pack: Wrap status reports inside
side-band-64k, 2010-02-05), but we do not mention it
explicitly. Let's do so.

Note that receive-pack does not understand side-band, which
was obsolete by that point.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agodocs: fix 'report-status' protocol capability thinko
Jeff King [Wed, 24 Jul 2013 08:01:21 +0000 (04:01 -0400)]
docs: fix 'report-status' protocol capability thinko

The report-status capability is understood by receive-pack,
not upload-pack.

Signed-off-by: Jeff King <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agogit-completion.bash: replace zsh notation that breaks bash 3.X
Brandon Casey [Fri, 18 Jan 2013 19:24:01 +0000 (11:24 -0800)]
git-completion.bash: replace zsh notation that breaks bash 3.X

50c5885e (git-completion.bash: replace zsh notation that breaks bash
3.X, 2013-01-18) fixed a zsh-ism introduced earlier to append to an
array, which older versions of bash (3.0) did not grok.  This was
again broken by 734b2f05 (completion: synchronize zsh wrapper,
2013-05-08).

Cherry-pick the fix again to let those with older bash use the
completion script.

Signed-off-by: Brandon Casey <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4211: fix incorrect rebase at f8395edc (range-set: satisfy non-empty ranges invariant)
Junio C Hamano [Wed, 24 Jul 2013 14:53:25 +0000 (07:53 -0700)]
t4211: fix incorrect rebase at f8395edc (range-set: satisfy non-empty ranges invariant)

Wnen I rewrote "cat b.c | wc -l" into "wc -l <b.c" to squash in a
suggestion on the list to this series, I screwed up subsequent
rebase.  Fix it up.

Signed-off-by: Junio C Hamano <redacted>
12 years agosmart http: use the same connectivity check on cloning
Nguyễn Thái Ngọc Duy [Sun, 21 Jul 2013 08:18:05 +0000 (15:18 +0700)]
smart http: use the same connectivity check on cloning

This is an extension of c6807a4 (clone: open a shortcut for
connectivity check - 2013-05-26) to reduce the cost of connectivity
check at clone time, this time with smart http protocol.

Signed-off-by: Nguyễn Thái Ngọc Duy <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agohg-to-git: --allow-empty-message in git commit
Maurício C Antunes [Sat, 20 Jul 2013 16:33:20 +0000 (13:33 -0300)]
hg-to-git: --allow-empty-message in git commit

Do not fail to import mercurial commits with empty commit messages.

Signed-off-by: Maurício C Antunes <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'es/line-log-further-fixes' into tr/line-log
Junio C Hamano [Tue, 23 Jul 2013 19:10:06 +0000 (12:10 -0700)]
Merge branch 'es/line-log-further-fixes' into tr/line-log

* es/line-log-further-fixes:
  line-log: fix "log -LN" crash when N is last line of file
  range-set: satisfy non-empty ranges invariant
  t4211: demonstrate crash when first -L encountered is empty range
  t4211: demonstrate empty -L range crash
  range-set: fix sort_and_merge_range_set() corner case bug
  range_set: fix coalescing bug when range is a subset of another
  t4211: fix broken test when one -L range is subset of another

12 years agoline-log: fix "log -LN" crash when N is last line of file
Eric Sunshine [Tue, 23 Jul 2013 14:28:08 +0000 (10:28 -0400)]
line-log: fix "log -LN" crash when N is last line of file

range-set invariants are: ranges must be (1) non-empty, (2) disjoint,
(3) sorted in ascending order.

line_log_data_insert() breaks the non-empty invariant under the
following conditions: the incoming range is empty and the pathname
attached to the range has not yet been encountered. In this case,
line_log_data_insert() assigns the empty range to a new line_log_data
record without taking any action to ensure that the empty range is
eventually folded out.  Subsequent range-set functions crash or throw an
assertion failure upon encountering such an anomaly.  Fix this bug.

Signed-off-by: Eric Sunshine <redacted>
Acked-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agorange-set: satisfy non-empty ranges invariant
Eric Sunshine [Tue, 23 Jul 2013 14:28:06 +0000 (10:28 -0400)]
range-set: satisfy non-empty ranges invariant

range-set invariants are: ranges must be (1) non-empty, (2) disjoint,
(3) sorted in ascending order.

During processing, various range-set utility functions break the
invariants (for instance, by adding empty ranges), with the
expectation that a finalizing sort_and_merge_range_set() will restore
sanity.

sort_and_merge_range_set(), however, neglects to fold out empty
ranges, thus it fails to satisfy the non-empty constraint. Subsequent
range-set functions crash or throw an assertion failure upon
encountering such an anomaly. Rectify the situation by having
sort_and_merge_range_set() fold out empty ranges.

Signed-off-by: Eric Sunshine <redacted>
Acked-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4211: demonstrate crash when first -L encountered is empty range
Eric Sunshine [Tue, 23 Jul 2013 14:28:07 +0000 (10:28 -0400)]
t4211: demonstrate crash when first -L encountered is empty range

Signed-off-by: Eric Sunshine <redacted>
Acked-by: Thomas Rast <redacted>
Helped-by: SZEDER Gábor <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agot4211: demonstrate empty -L range crash
Eric Sunshine [Tue, 23 Jul 2013 14:28:05 +0000 (10:28 -0400)]
t4211: demonstrate empty -L range crash

Signed-off-by: Eric Sunshine <redacted>
Acked-by: Thomas Rast <redacted>
Helped-by: SZEDER Gábor <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agorange-set: fix sort_and_merge_range_set() corner case bug
Eric Sunshine [Tue, 23 Jul 2013 14:28:04 +0000 (10:28 -0400)]
range-set: fix sort_and_merge_range_set() corner case bug

When handed an empty range_set (range_set.nr == 0),
sort_and_merge_range_set() incorrectly sets range_set.nr to 1 at exit.
Subsequent range_set functions then access the bogus range at element
zero and crash or throw an assertion failure. Fix this bug.

Signed-off-by: Eric Sunshine <redacted>
Acked-by: Thomas Rast <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoopen_istream: remove unneeded check for null pointer
Stefan Beller [Tue, 23 Jul 2013 13:16:04 +0000 (15:16 +0200)]
open_istream: remove unneeded check for null pointer

'st' is allocated via xmalloc a few lines before and passed to
the stream opening functions.
The xmalloc function is written in a way that either 'st' is allocated
valid memory or xmalloc already dies.
The function calls to open_istream_* do not change 'st', as the pointer is
passed by reference and not a pointer of a pointer.

Hence 'st' cannot be null at that part of the code.

Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agorm: do not set a variable twice without intermediate reading.
Stefan Beller [Tue, 23 Jul 2013 09:19:22 +0000 (11:19 +0200)]
rm: do not set a variable twice without intermediate reading.

Just the next line assigns a non-null value to seen.

Signed-off-by: Stefan Beller <redacted>
Signed-off-by: Junio C Hamano <redacted>
12 years agoMerge branch 'mv/merge-ff-tristate'
Junio C Hamano [Tue, 23 Jul 2013 17:09:49 +0000 (10:09 -0700)]
Merge branch 'mv/merge-ff-tristate'

* mv/merge-ff-tristate:
  t7600: fix typo in test title

12 years agot7600: fix typo in test title
Junio C Hamano [Tue, 23 Jul 2013 17:08:40 +0000 (10:08 -0700)]
t7600: fix typo in test title

Spotted by Ram, confirmed by Miklos.

Signed-off-by: Junio C Hamano <redacted>
12 years agot5533: test "push --force-with-lease"
Junio C Hamano [Tue, 9 Jul 2013 19:09:28 +0000 (12:09 -0700)]
t5533: test "push --force-with-lease"

Prepare two repositories, src and dst, the latter of which is a
clone of the former (with tracking branches), and push from the
latter into the former, with various --force-with-lease options.

Signed-off-by: Junio C Hamano <redacted>
12 years agopush --force-with-lease: tie it all together
Junio C Hamano [Mon, 8 Jul 2013 21:42:40 +0000 (14:42 -0700)]
push --force-with-lease: tie it all together

This teaches the deepest part of the callchain for "git push" (and
"git send-pack") to enforce "the old value of the ref must be this,
otherwise fail this push" (aka "compare-and-swap" / "--lockref").

Signed-off-by: Junio C Hamano <redacted>
12 years agopush --force-with-lease: implement logic to populate old_sha1_expect[]
Junio C Hamano [Tue, 9 Jul 2013 18:01:06 +0000 (11:01 -0700)]
push --force-with-lease: implement logic to populate old_sha1_expect[]

This plugs the push_cas_option data collected by the command line
option parser to the transport system with a new function
apply_push_cas(), which is called after match_push_refs() has
already been called.

At this point, we know which remote we are talking to, and what
remote refs we are going to update, so we can fill in the details
that may have been missing from the command line, such as

 (1) what abbreviated refname the user gave us matches the actual
     refname at the remote; and

 (2) which remote-tracking branch in our local repository to read
     the value of the object to expect at the remote.

to populate the old_sha1_expect[] field of each of the remote ref.
As stated in the documentation, the use of remote-tracking branch
as the default is a tentative one, and we may come up with a better
logic as we gain experience.

Still nobody uses this information, which is the topic of the next
patch.

Signed-off-by: Junio C Hamano <redacted>
git clone https://git.99rst.org/PROJECT