summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Documentation/RelNotes/1.8.3.txt174
-rw-r--r--Documentation/git-commit.txt4
-rw-r--r--Documentation/git-remote.txt4
-rwxr-xr-xGIT-VERSION-GEN2
-rw-r--r--builtin/merge-tree.c6
-rw-r--r--builtin/remote.c2
-rw-r--r--contrib/completion/git-completion.zsh2
-rw-r--r--contrib/completion/git-prompt.sh21
-rwxr-xr-xcontrib/remote-helpers/git-remote-bzr307
-rwxr-xr-xcontrib/remote-helpers/test-bzr.sh72
-rw-r--r--git-rebase--interactive.sh5
-rw-r--r--perl/Git.pm2
-rw-r--r--pretty.c49
-rw-r--r--sha1_file.c1
-rwxr-xr-xt/t4300-merge-tree.sh51
-rwxr-xr-xt/t5505-remote.sh22
-rwxr-xr-xt/t5801-remote-helpers.sh14
-rwxr-xr-xt/t9903-bash-prompt.sh14
-rw-r--r--transport-helper.c1
19 files changed, 537 insertions, 216 deletions
diff --git a/Documentation/RelNotes/1.8.3.txt b/Documentation/RelNotes/1.8.3.txt
index 6d25165884..b0cd887403 100644
--- a/Documentation/RelNotes/1.8.3.txt
+++ b/Documentation/RelNotes/1.8.3.txt
@@ -8,23 +8,22 @@ When "git push [$there]" does not say what to push, we have used the
traditional "matching" semantics so far (all your branches were sent
to the remote as long as there already are branches of the same name
over there). In Git 2.0, the default will change to the "simple"
-semantics that pushes the current branch to the branch with the same
-name, only when the current branch is set to integrate with that
-remote branch. There is a user preference configuration variable
+semantics that pushes only the current branch to the branch with the same
+name, and only when the current branch is set to integrate with that
+remote branch. Use the user preference configuration variable
"push.default" to change this. If you are an old-timer who is used
-to the "matching" semantics, you can set it to "matching" to keep the
-traditional behaviour. If you want to live in the future early,
-you can set it to "simple" today without waiting for Git 2.0.
-
-When "git add -u" and "git add -A", that does not specify what paths
-to add on the command line is run from inside a subdirectory, these
-commands will operate on the entire tree in Git 2.0 for consistency
-with "git commit -a" and other commands. Because there will be no
-mechanism to make "git add -u" behave as if "git add -u .", it is
-important for those who are used to "git add -u" (without pathspec)
-updating the index only for paths in the current subdirectory to start
-training their fingers to explicitly say "git add -u ." when they mean
-it before Git 2.0 comes. A warning is issued when these commands are
+to the "matching" semantics, you can set the variable to "matching"
+to keep the traditional behaviour. If you want to live in the future
+early, you can set it to "simple" today without waiting for Git 2.0.
+
+When "git add -u" (and "git add -A") is run inside a subdirectory and
+does not specify which paths to add on the command line, it
+will operate on the entire tree in Git 2.0 for consistency
+with "git commit -a" and other commands. There will be no
+mechanism to make plain "git add -u" behave like "git add -u .".
+Current users of "git add -u" (without a pathspec) should start
+training their fingers to explicitly say "git add -u ."
+before Git 2.0 comes. A warning is issued when these commands are
run without a pathspec and when you have local changes outside the
current directory, because the behaviour in Git 2.0 will be different
from today's version in such a situation.
@@ -33,8 +32,8 @@ In Git 2.0, "git add <path>" will behave as "git add -A <path>", so
that "git add dir/" will notice paths you removed from the directory
and record the removal. Versions before Git 2.0, including this
release, will keep ignoring removals, but the users who rely on this
-behaviour is encouraged to use "git add --ignore-removal <path>" and
-get used to it.
+behaviour are encouraged to start using "git add --ignore-removal <path>"
+now before 2.0 is released.
Updates since v1.8.2
@@ -47,6 +46,10 @@ Foreign interface
UI, Workflows & Features
+ * The prompt string generator (in contrib/completion/) learned to
+ show how many changes there are in total and how many have been
+ replayed during a "git rebase" session.
+
* "git branch --vv" learned to paint the name of the branch it
integrates with in a different color (color.branch.upstream,
which defaults to blue).
@@ -114,7 +117,7 @@ UI, Workflows & Features
* "git status" suggests users to look into using --untracked=no option
when it takes too long.
- * "git status" shows a bit more information to "git status" during a
+ * "git status" shows a bit more information during a
rebase/bisect session.
* "git fetch" learned to fetch a commit at the tip of an unadvertised
@@ -148,8 +151,8 @@ UI, Workflows & Features
* "git mergetool" now feeds files to the "p4merge" backend in the
order that matches the p4 convention, where "theirs" is usually
- shown on the left side, which is the opposite from other backend
- expects.
+ shown on the left side, which is the opposite from what other backends
+ expect.
* "show/log" now honors gpg.program configuration just like other
parts of the code that use GnuPG.
@@ -159,9 +162,9 @@ UI, Workflows & Features
* "git difftool" allows the user to write into the temporary files
being shown; if the user makes changes to the working tree at the
- same time, one of the changes has to be lost in such a case, but it
- tells the user what happened and refrains from overwriting the copy
- in the working tree.
+ same time, it now refrains from overwriting the copy in the working
+ tree and leaves the temporary file so that changes can be merged
+ manually.
* There was no good way to ask "I have a random string that came from
outside world. I want to turn it into a 40-hex object name while
@@ -173,7 +176,7 @@ Performance, Internal Implementation, etc.
* Updates for building under msvc.
- * A handful of issues in the code to traverse working tree to find
+ * A handful of issues in the code that traverses the working tree to find
untracked and/or ignored files have been fixed, and the general
codepath involved in "status -u" and "clean" have been cleaned up
and optimized.
@@ -182,15 +185,15 @@ Performance, Internal Implementation, etc.
pack has been shrunk.
* The logic to coalesce the same lines removed from the parents in
- the output from "diff -c/--cc" has been updated, but with an O(n^2)
+ the output from "diff -c/--cc" has been updated, but with O(n^2)
complexity, so this might turn out to be undesirable.
* The code to enforce permission bits on files in $GIT_DIR/ for
- shared repositories have been simplified.
+ shared repositories has been simplified.
- * A few codepaths knew how much data they need to put in the
- hashtables they use upfront, but still started from a small table
- repeatedly growing and rehashing.
+ * A few codepaths know how much data they need to put in the
+ hashtables they use when they start, but still began with small tables
+ and repeatedly grew and rehashed them.
* The API to walk reflog entries from the latest to older, which was
necessary for operations such as "git checkout -", was cumbersome
@@ -202,9 +205,9 @@ Performance, Internal Implementation, etc.
* The pkt-line API, implementation and its callers have been cleaned
up to make them more robust.
- * Cygwin port has a faster-but-lying lstat(2) emulation whose
+ * The Cygwin port has a faster-but-lying lstat(2) emulation whose
incorrectness does not matter in practice except for a few
- codepaths, and setting permission bits to directories is a codepath
+ codepaths, and setting permission bits on directories is a codepath
that needs to use a more correct one.
* "git checkout" had repeated pathspec matches on the same paths,
@@ -225,42 +228,51 @@ Unless otherwise noted, all the fixes since v1.8.2 in the maintenance
track are contained in this release (see release notes to them for
details).
- * When receive-pack detects error in the pack header it received in
+ * Recent versions of File::Temp (used by "git svn") started blowing
+ up when its tempfile sub is called as a class method; updated the
+ callsite to call it as a plain vanilla function to fix it.
+ (merge eafc2dd hb/git-pm-tempfile later to maint).
+
+ * Various subcommands of "git remote" simply ignored extraneous
+ command line arguments instead of diagnosing them as errors.
+ (merge b17dd3f tr/remote-tighten-commandline-parsing later to maint).
+
+ * When receive-pack detects an error in the pack header it received in
order to decide which of unpack-objects or index-pack to run, it
- returned without closing the error stream, which led to a hang
+ returned without closing the error stream, which led to a hung
sideband thread.
- * Zsh completion forgot that '%' character used to signal untracked
+ * Zsh completion forgot that the '%' character used to signal untracked
files needs to be escaped with another '%'.
* A commit object whose author or committer ident are malformed
- crashed some code that trusted that a name, an email and an
+ crashed some code that trusted that a name, an email and a
timestamp can always be found in it.
* When "upload-pack" fails while generating a pack in response to
- "git fetch" (or "git clone"), the receiving side mistakenly said
- there was a programming error to trigger the die handler
+ "git fetch" (or "git clone"), the receiving side had
+ a programming error that triggered the die handler
recursively.
- * "rev-list --stdin" and friends kept bogus pointers into input
- buffer around as human readble object names. This was not a huge
+ * "rev-list --stdin" and friends kept bogus pointers into the input
+ buffer around as human readable object names. This was not a huge
problem but was exposed by a new change that uses these names in
error output.
(merge 70d26c6 tr/copy-revisions-from-stdin later to maint).
* Smart-capable HTTP servers were not restricted via the
- GIT_NAMESPACE mechanism when talking with commit-walker clients,
- like they do when talking with smart HTTP clients.
+ GIT_NAMESPACE mechanism when talking with commit-walking clients,
+ like they are when talking with smart HTTP clients.
(merge 6130f86 jk/http-dumb-namespaces later to maint).
* "git merge-tree" did not omit a merge result that is identical to
- "our" side in certain cases.
+ the "our" side in certain cases.
(merge aacecc3 jk/merge-tree-added-identically later to maint).
- * Perl scripts like "git-svn" closed (not redirecting to /dev/null)
+ * Perl scripts like "git-svn" closed (instead of redirecting to /dev/null)
the standard error stream, which is not a very smart thing to do.
- Later open may return file descriptor #2 for unrelated purpose, and
- error reporting code may write into them.
+ A later open may return file descriptor #2 for an unrelated purpose, and
+ error reporting code may write into it.
* "git show-branch" was not prepared to show a very long run of
ancestor operators e.g. foobar^2~2^2^2^2...^2~4 correctly.
@@ -268,17 +280,17 @@ details).
* "git diff --diff-algorithm algo" is also understood as "git diff
--diff-algorithm=algo".
- * The new core.commentchar configuration was not applied to a few
+ * The new core.commentchar configuration was not applied in a few
places.
- * "git bundle" did not like a bundle created using a commit without
- any message as its one of the prerequistes.
+ * "git bundle" erroneously bailed out when parsing a valid bundle
+ containing a prerequisite commit without a commit message.
* "git log -S/-G" started paying attention to textconv filter, but
- there was no way to disable this. Make it honor --no-textconv
+ there was no way to disable this. Make it honor the --no-textconv
option.
- * When used with "-d temporary-directory" option, "git filter-branch"
+ * When used with the "-d temporary-directory" option, "git filter-branch"
failed to come back to the original working tree to perform the
final clean-up procedure.
@@ -287,9 +299,9 @@ details).
not pay much attention to the annotated tag payload. Make the code
notice the type of the tag object, in addition to the dwim_ref()
based classification the current code uses (i.e. the name appears
- in refs/tags/) to decide when to special case merging of tags.
+ in refs/tags/) to decide when to special-case tag merging.
- * Fix 1.8.1.x regression that stopped matching "dir" (without
+ * Fix a 1.8.1.x regression that stopped matching "dir" (without a
trailing slash) to a directory "dir".
(merge efa5f82 jc/directory-attrs-regression-fix later to maint-1.8.1).
@@ -300,46 +312,46 @@ details).
* The prompt string generator (in contrib/completion/) did not notice
when we are in a middle of a "git revert" session.
- * "submodule summary --summary-limit" option did not support
+ * "submodule summary --summary-limit" option did not support the
"--option=value" form.
* "index-pack --fix-thin" used an uninitialized value to compute
- delta depths of objects it appends to the resulting pack.
+ the delta depths of objects it appends to the resulting pack.
- * "index-pack --verify-stat" used a few counters outside protection
- of mutex, possibly showing incorrect numbers.
+ * "index-pack --verify-stat" used a few counters outside the protection
+ of a mutex, possibly showing incorrect numbers.
* The code to keep track of what directory names are known to Git on
- platforms with case insensitive filesystems can get confused upon a
- hash collision between these pathnames and looped forever.
+ platforms with case insensitive filesystems could get confused upon a
+ hash collision between these pathnames and would loop forever.
- * Annotated tags outside refs/tags/ hierarchy were not advertised
- correctly to the ls-remote and fetch with recent version of Git.
+ * Annotated tags outside the refs/tags/ hierarchy were not advertised
+ correctly to ls-remote and fetch with recent versions of Git.
- * Recent optimization broke shallow clones.
+ * Recent optimizations broke shallow clones.
* "git cmd -- ':(top'" was not diagnosed as an invalid syntax, and
instead the parser kept reading beyond the end of the string.
* "git tag -f <tag>" always said "Updated tag '<tag>'" even when
- creating a new tag (i.e. not overwriting nor updating).
+ creating a new tag (i.e. neither overwriting nor updating).
* "git p4" did not behave well when the path to the root of the P4
client was not its real path.
(merge bbd8486 pw/p4-symlinked-root later to maint).
- * "git archive" reports a failure when asked to create an archive out
- of an empty tree. It would be more intuitive to give an empty
+ * "git archive" reported a failure when asked to create an archive out
+ of an empty tree. It is more intuitive to give an empty
archive back in such a case.
- * When "format-patch" quoted a non-ascii strings on the header files,
+ * When "format-patch" quoted a non-ascii string in header files,
it incorrectly applied rfc2047 and chopped a single character in
- the middle of it.
+ the middle of the string.
* An aliased command spawned from a bare repository that does not say
- it is bare with "core.bare = yes" is treated as non-bare by mistake.
+ it is bare with "core.bare = yes" was treated as non-bare by mistake.
- * In "git reflog expire", REACHABLE bit was not cleared from the
+ * In "git reflog expire", the REACHABLE bit was not cleared from the
correct objects.
* The logic used by "git diff -M --stat" to shorten the names of
@@ -347,9 +359,9 @@ details).
common prefix and suffix between the two filenames overlapped.
* The "--match=<pattern>" option of "git describe", when used with
- "--all" to allow refs that are not annotated tags to be used as a
+ "--all" to allow refs that are not annotated tags to be a
base of description, did not restrict the output from the command
- to those that match the given pattern.
+ to those refs that match the given pattern.
* Clarify in the documentation "what" gets pushed to "where" when the
command line to "git push" does not say these explicitly.
@@ -357,7 +369,7 @@ details).
* The "--color=<when>" argument to the commands in the diff family
was described poorly.
- * The arguments given to pre-rebase hook were not documented.
+ * The arguments given to the pre-rebase hook were not documented.
* The v4 index format was not documented.
@@ -375,7 +387,7 @@ details).
* In the v1.8.0 era, we changed symbols that do not have to be global
to file scope static, but a few functions in graph.c were used by
- CGit from sideways bypassing the entry points of the API the
+ CGit sideways, bypassing the entry points of the API the
in-tree users use.
* "git update-index -h" did not do the usual "-h(elp)" thing.
@@ -388,30 +400,30 @@ details).
$msg already ended with one.
* The SSL peer verification done by "git imap-send" did not ask for
- Server Name Indication (RFC 4366), failing to connect SSL/TLS
+ Server Name Indication (RFC 4366), failing to connect to SSL/TLS
sites that serve multiple hostnames on a single IP.
* perl/Git.pm::cat_blob slurped everything in core only to write it
out to a file descriptor, which was not a very smart thing to do.
* "git branch" did not bother to check nonsense command line
- parameters and issue errors in many cases.
+ parameters. It now issues errors in many cases.
- * Verification of signed tags were not done correctly when not in C
+ * Verification of signed tags was not done correctly when not in C
or en/US locale.
* Some platforms and users spell UTF-8 differently; retry with the
most official "UTF-8" when the system does not understand the
- user-supplied encoding name that are the common alternative
- spellings of UTF-8.
+ user-supplied encoding name that is a common alternative
+ spelling of UTF-8.
- * When export-subst is used, "zip" output recorded incorrect
+ * When export-subst is used, "zip" output recorded an incorrect
size of the file.
* "git am $maildir/" applied messages in an unexpected order; sort
filenames read from the maildir/ in a way that is more likely to
- sort messages in the order the writing MUA meant to, by sorting
- numeric segment in numeric order and non-numeric segment in
+ sort the messages in the order the writing MUA meant to, by sorting
+ numeric segments in numeric order and non-numeric segments in
alphabetical order.
* "git submodule update", when recursed into sub-submodules, did not
diff --git a/Documentation/git-commit.txt b/Documentation/git-commit.txt
index 9b1be5581d..8172938653 100644
--- a/Documentation/git-commit.txt
+++ b/Documentation/git-commit.txt
@@ -197,8 +197,8 @@ variable (see linkgit:git-config[1]).
-e::
--edit::
The message taken from file with `-F`, command line with
- `-m`, and from file with `-C` are usually used as the
- commit log message unmodified. This option lets you
+ `-m`, and from commit object with `-C` are usually used as
+ the commit log message unmodified. This option lets you
further edit the message taken from these sources.
--no-edit::
diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index e8c396b5f9..7a6f354680 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -18,8 +18,8 @@ SYNOPSIS
'git remote set-url' [--push] <name> <newurl> [<oldurl>]
'git remote set-url --add' [--push] <name> <newurl>
'git remote set-url --delete' [--push] <name> <url>
-'git remote' [-v | --verbose] 'show' [-n] <name>
-'git remote prune' [-n | --dry-run] <name>
+'git remote' [-v | --verbose] 'show' [-n] <name>...
+'git remote prune' [-n | --dry-run] <name>...
'git remote' [-v | --verbose] 'update' [-p | --prune] [(<group> | <remote>)...]
DESCRIPTION
diff --git a/GIT-VERSION-GEN b/GIT-VERSION-GEN
index 293d0b9fa4..7a24aca9d6 100755
--- a/GIT-VERSION-GEN
+++ b/GIT-VERSION-GEN
@@ -1,7 +1,7 @@
#!/bin/sh
GVF=GIT-VERSION-FILE
-DEF_VER=v1.8.3-rc0
+DEF_VER=v1.8.3-rc1
LF='
'
diff --git a/builtin/merge-tree.c b/builtin/merge-tree.c
index ec49917a36..61cbde4094 100644
--- a/builtin/merge-tree.c
+++ b/builtin/merge-tree.c
@@ -251,7 +251,11 @@ static void unresolved(const struct traverse_info *info, struct name_entry n[3])
for (i = 0; i < 3; i++) {
mask |= (1 << i);
- if (n[i].mode && S_ISDIR(n[i].mode))
+ /*
+ * Treat missing entries as directories so that we return
+ * after unresolved_directory has handled this.
+ */
+ if (!n[i].mode || S_ISDIR(n[i].mode))
dirmask |= (1 << i);
}
diff --git a/builtin/remote.c b/builtin/remote.c
index 937484d7c7..5e54d367b8 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -178,7 +178,7 @@ static int add(int argc, const char **argv)
argc = parse_options(argc, argv, NULL, options, builtin_remote_add_usage,
0);
- if (argc < 2)
+ if (argc != 2)
usage_with_options(builtin_remote_add_usage, options);
if (mirror && master)
diff --git a/contrib/completion/git-completion.zsh b/contrib/completion/git-completion.zsh
index 49f0cb8f69..2565d2eef4 100644
--- a/contrib/completion/git-completion.zsh
+++ b/contrib/completion/git-completion.zsh
@@ -198,7 +198,7 @@ _git ()
emulate ksh -c __${service}_main
fi
- let _ret && _default -S '' && _ret=0
+ let _ret && _default && _ret=0
return _ret
}
diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh
index 054c52e90a..eaf5c369aa 100644
--- a/contrib/completion/git-prompt.sh
+++ b/contrib/completion/git-prompt.sh
@@ -263,14 +263,21 @@ __git_ps1 ()
else
local r=""
local b=""
- if [ -f "$g/rebase-merge/interactive" ]; then
- r="|REBASE-i"
- b="$(cat "$g/rebase-merge/head-name")"
- elif [ -d "$g/rebase-merge" ]; then
- r="|REBASE-m"
+ local step=""
+ local total=""
+ if [ -d "$g/rebase-merge" ]; then
b="$(cat "$g/rebase-merge/head-name")"
+ step=$(cat "$g/rebase-merge/msgnum")
+ total=$(cat "$g/rebase-merge/end")
+ if [ -f "$g/rebase-merge/interactive" ]; then
+ r="|REBASE-i"
+ else
+ r="|REBASE-m"
+ fi
else
if [ -d "$g/rebase-apply" ]; then
+ step=$(cat "$g/rebase-apply/next")
+ total=$(cat "$g/rebase-apply/last")
if [ -f "$g/rebase-apply/rebasing" ]; then
r="|REBASE"
elif [ -f "$g/rebase-apply/applying" ]; then
@@ -308,6 +315,10 @@ __git_ps1 ()
}
fi
+ if [ -n "$step" ] && [ -n "$total" ]; then
+ r="$r $step/$total"
+ fi
+
local w=""
local i=""
local s=""
diff --git a/contrib/remote-helpers/git-remote-bzr b/contrib/remote-helpers/git-remote-bzr
index c19ed0e26b..0ef30f8d55 100755
--- a/contrib/remote-helpers/git-remote-bzr
+++ b/contrib/remote-helpers/git-remote-bzr
@@ -13,6 +13,9 @@
# or
# % git clone bzr::lp:myrepo
#
+# If you want to specify which branches you want track (per repo):
+# git config remote-bzr.branches 'trunk, devel, test'
+#
import sys
@@ -27,6 +30,7 @@ import bzrlib.generate_ids
import bzrlib.transport
import bzrlib.errors
import bzrlib.ui
+import bzrlib.urlutils
import sys
import os
@@ -37,6 +41,7 @@ import atexit, shutil, hashlib, urlparse, subprocess
NAME_RE = re.compile('^([^<>]+)')
AUTHOR_RE = re.compile('^([^<>]+?)? ?<([^<>]*)>$')
+EMAIL_RE = re.compile('^([^<>]+[^ \\\t<>])?\\b(?:[ \\t<>]*?)\\b([^ \\t<>]+@[^ \\t<>]+)')
RAW_AUTHOR_RE = re.compile('^(\w+) (.+)? <(.*)> (\d+) ([+-]\d+)')
def die(msg, *args):
@@ -49,6 +54,12 @@ def warn(msg, *args):
def gittz(tz):
return '%+03d%02d' % (tz / 3600, tz % 3600 / 60)
+def get_config(config):
+ cmd = ['git', 'config', '--get', config]
+ process = subprocess.Popen(cmd, stdout=subprocess.PIPE)
+ output, _ = process.communicate()
+ return output
+
class Marks:
def __init__(self, path):
@@ -84,7 +95,7 @@ class Marks:
return self.marks[rev]
def to_rev(self, mark):
- return self.rev_marks[mark]
+ return str(self.rev_marks[mark])
def next_mark(self):
self.last_mark += 1
@@ -174,9 +185,19 @@ def fixup_user(user):
name = m.group(1)
mail = m.group(2).strip()
else:
- m = NAME_RE.match(user)
+ m = EMAIL_RE.match(user)
if m:
- name = m.group(1).strip()
+ name = m.group(1)
+ mail = m.group(2)
+ else:
+ m = NAME_RE.match(user)
+ if m:
+ name = m.group(1).strip()
+
+ if not name:
+ name = 'unknown'
+ if not mail:
+ mail = 'Unknown'
return '%s <%s>' % (name, mail)
@@ -250,22 +271,28 @@ def export_files(tree, files):
return final
-def export_branch(branch, name):
+def export_branch(repo, name):
global prefix
ref = '%s/heads/%s' % (prefix, name)
tip = marks.get_tip(name)
+ branch = bzrlib.branch.Branch.open(branches[name])
repo = branch.repository
- repo.lock_read()
+
+ branch.lock_read()
revs = branch.iter_merge_sorted_revisions(None, tip, 'exclude', 'forward')
- count = 0
+ tip_revno = branch.revision_id_to_revno(tip)
+ last_revno, _ = branch.last_revision_info()
+ total = last_revno - tip_revno
- revs = [revid for revid, _, _, _ in revs if not marks.is_marked(revid)]
+ for revid, _, seq, _ in revs:
- for revid in revs:
+ if marks.is_marked(revid):
+ continue
rev = repo.get_revision(revid)
+ revno = seq[0]
parents = rev.parent_ids
time = rev.timestamp
@@ -320,12 +347,15 @@ def export_branch(branch, name):
print "M %s :%u %s" % f
print
- count += 1
- if (count % 100 == 0):
- print "progress revision %s (%d/%d)" % (revid, count, len(revs))
- print "#############################################################"
+ if len(seq) > 1:
+ # let's skip branch revisions from the progress report
+ continue
- repo.unlock()
+ progress = (revno - tip_revno)
+ if (progress % 100 == 0):
+ print "progress revision %d '%s' (%d/%d)" % (revno, name, progress, total)
+
+ branch.unlock()
revid = branch.last_revision()
@@ -347,23 +377,24 @@ def export_tag(repo, name):
def do_import(parser):
global dirname
- branch = parser.repo
+ repo = parser.repo
path = os.path.join(dirname, 'marks-git')
print "feature done"
if os.path.exists(path):
print "feature import-marks=%s" % path
print "feature export-marks=%s" % path
+ print "feature force"
sys.stdout.flush()
while parser.check('import'):
ref = parser[1]
if ref.startswith('refs/heads/'):
name = ref[len('refs/heads/'):]
- export_branch(branch, name)
+ export_branch(repo, name)
if ref.startswith('refs/tags/'):
name = ref[len('refs/tags/'):]
- export_tag(branch, name)
+ export_tag(repo, name)
parser.next()
print 'done'
@@ -382,23 +413,21 @@ def parse_blob(parser):
class CustomTree():
- def __init__(self, repo, revid, parents, files):
+ def __init__(self, branch, revid, parents, files):
global files_cache
- self.repo = repo
- self.revid = revid
- self.parents = parents
self.updates = {}
+ self.branch = branch
def copy_tree(revid):
files = files_cache[revid] = {}
- tree = repo.repository.revision_tree(revid)
- repo.lock_read()
+ branch.lock_read()
+ tree = branch.repository.revision_tree(revid)
try:
for path, entry in tree.iter_entries_by_dir():
- files[path] = entry.file_id
+ files[path] = [entry.file_id, None]
finally:
- repo.unlock()
+ branch.unlock()
return files
if len(parents) == 0:
@@ -411,12 +440,18 @@ class CustomTree():
self.base_files = copy_tree(self.base_id)
self.files = files_cache[revid] = self.base_files.copy()
+ self.rev_files = {}
+
+ for path, data in self.files.iteritems():
+ fid, mark = data
+ self.rev_files[fid] = [path, mark]
for path, f in files.iteritems():
- fid = self.files.get(path, None)
+ fid, mark = self.files.get(path, [None, None])
if not fid:
fid = bzrlib.generate_ids.gen_file_id(path)
f['path'] = path
+ self.rev_files[fid] = [path, mark]
self.updates[fid] = f
def last_revision(self):
@@ -426,16 +461,16 @@ class CustomTree():
changes = []
def get_parent(dirname, basename):
- parent_fid = self.base_files.get(dirname, None)
+ parent_fid, mark = self.base_files.get(dirname, [None, None])
if parent_fid:
return parent_fid
- parent_fid = self.files.get(dirname, None)
+ parent_fid, mark = self.files.get(dirname, [None, None])
if parent_fid:
return parent_fid
if basename == '':
return None
fid = bzrlib.generate_ids.gen_file_id(path)
- d = add_entry(fid, dirname, 'directory')
+ add_entry(fid, dirname, 'directory')
return fid
def add_entry(fid, path, kind, mode = None):
@@ -456,9 +491,8 @@ class CustomTree():
(None, basename),
(None, kind),
(None, executable))
- self.files[path] = change[0]
+ self.files[path] = [change[0], None]
changes.append(change)
- return change
def update_entry(fid, path, kind, mode = None):
dirname, basename = os.path.split(path)
@@ -478,9 +512,8 @@ class CustomTree():
(None, basename),
(None, kind),
(None, executable))
- self.files[path] = change[0]
+ self.files[path] = [change[0], None]
changes.append(change)
- return change
def remove_entry(fid, path, kind):
dirname, basename = os.path.split(path)
@@ -495,7 +528,6 @@ class CustomTree():
(None, None))
del self.files[path]
changes.append(change)
- return change
for fid, f in self.updates.iteritems():
path = f['path']
@@ -509,13 +541,30 @@ class CustomTree():
else:
add_entry(fid, path, 'file', f['mode'])
+ self.files[path][1] = f['mark']
+ self.rev_files[fid][1] = f['mark']
+
return changes
+ def get_content(self, file_id):
+ path, mark = self.rev_files[file_id]
+ if mark:
+ return blob_marks[mark]
+
+ # last resort
+ tree = self.branch.repository.revision_tree(self.base_id)
+ return tree.get_file_text(file_id)
+
def get_file_with_stat(self, file_id, path=None):
- return (StringIO.StringIO(self.updates[file_id]['data']), None)
+ content = self.get_content(file_id)
+ return (StringIO.StringIO(content), None)
def get_symlink_target(self, file_id):
- return self.updates[file_id]['data']
+ return self.get_content(file_id)
+
+ def id2path(self, file_id):
+ path, mark = self.rev_files[file_id]
+ return path
def c_style_unescape(string):
if string[0] == string[-1] == '"':
@@ -531,8 +580,11 @@ def parse_commit(parser):
ref = parser[1]
parser.next()
- if ref != 'refs/heads/master':
- die("bzr doesn't support multiple branches; use 'master'")
+ if ref.startswith('refs/heads/'):
+ name = ref[len('refs/heads/'):]
+ branch = bzrlib.branch.Branch.open(branches[name])
+ else:
+ die('unknown ref')
commit_mark = parser.get_mark()
parser.next()
@@ -559,7 +611,7 @@ def parse_commit(parser):
if parser.check('M'):
t, m, mark_ref, path = line.split(' ', 3)
mark = int(mark_ref[1:])
- f = { 'mode' : m, 'data' : blob_marks[mark] }
+ f = { 'mode' : m, 'mark' : mark }
elif parser.check('D'):
t, path = line.split(' ')
f = { 'deleted' : True }
@@ -568,20 +620,18 @@ def parse_commit(parser):
path = c_style_unescape(path).decode('utf-8')
files[path] = f
- repo = parser.repo
-
committer, date, tz = committer
- parents = [str(mark_to_rev(p)) for p in parents]
+ parents = [mark_to_rev(p) for p in parents]
revid = bzrlib.generate_ids.gen_revision_id(committer, date)
props = {}
- props['branch-nick'] = repo.nick
+ props['branch-nick'] = branch.nick
- mtree = CustomTree(repo, revid, parents, files)
+ mtree = CustomTree(branch, revid, parents, files)
changes = mtree.iter_changes()
- repo.lock_write()
+ branch.lock_write()
try:
- builder = repo.get_commit_builder(parents, None, date, tz, committer, props, revid)
+ builder = branch.get_commit_builder(parents, None, date, tz, committer, props, revid)
try:
list(builder.record_iter_changes(mtree, mtree.last_revision(), changes))
builder.finish_inventory()
@@ -590,7 +640,7 @@ def parse_commit(parser):
builder.abort()
raise
finally:
- repo.unlock()
+ branch.unlock()
parsed_refs[ref] = revid
marks.new_mark(revid, commit_mark)
@@ -601,9 +651,6 @@ def parse_reset(parser):
ref = parser[1]
parser.next()
- if ref != 'refs/heads/master':
- die("bzr doesn't support multiple branches; use 'master'")
-
# ugh
if parser.check('commit'):
parse_commit(parser)
@@ -616,7 +663,7 @@ def parse_reset(parser):
parsed_refs[ref] = mark_to_rev(from_mark)
def do_export(parser):
- global parsed_refs, dirname, peer
+ global parsed_refs, dirname
parser.next()
@@ -634,20 +681,33 @@ def do_export(parser):
else:
die('unhandled export command: %s' % line)
- repo = parser.repo
-
for ref, revid in parsed_refs.iteritems():
- if ref == 'refs/heads/master':
- repo.generate_revision_history(revid, marks.get_tip('master'))
- if peer:
+ if ref.startswith('refs/heads/'):
+ name = ref[len('refs/heads/'):]
+ branch = bzrlib.branch.Branch.open(branches[name])
+ branch.generate_revision_history(revid, marks.get_tip(name))
+
+ if name in peers:
+ peer = bzrlib.branch.Branch.open(peers[name])
try:
- repo.push(peer, stop_revision=revid)
+ peer.bzrdir.push_branch(branch, revision_id=revid)
except bzrlib.errors.DivergedBranches:
print "error %s non-fast forward" % ref
continue
- else:
- wt = repo.bzrdir.open_workingtree()
+
+ try:
+ wt = branch.bzrdir.open_workingtree()
wt.update()
+ except bzrlib.errors.NoWorkingTree:
+ pass
+ elif ref.startswith('refs/tags/'):
+ # TODO: implement tag push
+ print "error %s pushing tags not supported" % ref
+ continue
+ else:
+ # transport-helper/fast-export bugs
+ continue
+
print "ok %s" % ref
print
@@ -673,9 +733,15 @@ def ref_is_valid(name):
def do_list(parser):
global tags
- print "? refs/heads/%s" % 'master'
- branch = parser.repo
+ master_branch = None
+
+ for name in branches:
+ if not master_branch:
+ master_branch = name
+ print "? refs/heads/%s" % name
+
+ branch = bzrlib.branch.Branch.open(branches[master_branch])
branch.lock_read()
for tag, revid in branch.tags.get_tag_dict().items():
try:
@@ -687,36 +753,112 @@ def do_list(parser):
print "? refs/tags/%s" % tag
tags[tag] = revid
branch.unlock()
- print "@refs/heads/%s HEAD" % 'master'
+
+ print "@refs/heads/%s HEAD" % master_branch
print
+def get_remote_branch(origin, remote_branch, name):
+ global dirname, peers
+
+ branch_path = os.path.join(dirname, 'clone', name)
+ if os.path.exists(branch_path):
+ # pull
+ d = bzrlib.bzrdir.BzrDir.open(branch_path)
+ branch = d.open_branch()
+ try:
+ branch.pull(remote_branch, [], None, False)
+ except bzrlib.errors.DivergedBranches:
+ # use remote branch for now
+ return remote_branch
+ else:
+ # clone
+ d = origin.sprout(branch_path, None,
+ hardlink=True, create_tree_if_local=False,
+ force_new_repo=False,
+ source_branch=remote_branch)
+ branch = d.open_branch()
+
+ return branch
+
+def find_branches(repo, wanted):
+ transport = repo.user_transport
+
+ for fn in transport.iter_files_recursive():
+ if not fn.endswith('.bzr/branch-format'):
+ continue
+
+ name = subdir = fn[:-len('/.bzr/branch-format')]
+ name = name if name != '' else 'master'
+ name = name.replace('/', '+')
+
+ if wanted and not name in wanted:
+ continue
+
+ try:
+ cur = transport.clone(subdir)
+ branch = bzrlib.branch.Branch.open_from_transport(cur)
+ except bzrlib.errors.NotBranchError:
+ continue
+ else:
+ yield name, branch
+
def get_repo(url, alias):
- global dirname, peer
+ global dirname, peer, branches
+ normal_url = bzrlib.urlutils.normalize_url(url)
origin = bzrlib.bzrdir.BzrDir.open(url)
- branch = origin.open_branch()
+ is_local = isinstance(origin.transport, bzrlib.transport.local.LocalTransport)
+
+ shared_path = os.path.join(gitdir, 'bzr')
+ try:
+ shared_dir = bzrlib.bzrdir.BzrDir.open(shared_path)
+ except bzrlib.errors.NotBranchError:
+ shared_dir = bzrlib.bzrdir.BzrDir.create(shared_path)
+ try:
+ shared_repo = shared_dir.open_repository()
+ except bzrlib.errors.NoRepositoryPresent:
+ shared_repo = shared_dir.create_repository(shared=True)
- if not isinstance(origin.transport, bzrlib.transport.local.LocalTransport):
+ if not is_local:
clone_path = os.path.join(dirname, 'clone')
- remote_branch = branch
- if os.path.exists(clone_path):
- # pull
- d = bzrlib.bzrdir.BzrDir.open(clone_path)
- branch = d.open_branch()
- result = branch.pull(remote_branch, [], None, False)
+ if not os.path.exists(clone_path):
+ os.mkdir(clone_path)
+
+ try:
+ repo = origin.open_repository()
+ except bzrlib.errors.NoRepositoryPresent:
+ # branch
+
+ name = 'master'
+ remote_branch = origin.open_branch()
+
+ if not is_local:
+ peers[name] = remote_branch.base
+ branch = get_remote_branch(origin, remote_branch, name)
else:
- # clone
- d = origin.sprout(clone_path, None,
- hardlink=True, create_tree_if_local=False,
- source_branch=remote_branch)
- branch = d.open_branch()
- branch.bind(remote_branch)
-
- peer = remote_branch
+ branch = remote_branch
+
+ branches[name] = branch.base
+
+ return branch.repository
else:
- peer = None
+ # repository
- return branch
+ wanted = get_config('remote-bzr.branches').rstrip().split(', ')
+ # stupid python
+ wanted = [e for e in wanted if e]
+
+ for name, remote_branch in find_branches(repo, wanted):
+
+ if not is_local:
+ peers[name] = remote_branch.base
+ branch = get_remote_branch(origin, remote_branch, name)
+ else:
+ branch = remote_branch
+
+ branches[name] = branch.base
+
+ return repo
def fix_path(alias, orig_url):
url = urlparse.urlparse(orig_url, 'file')
@@ -727,12 +869,13 @@ def fix_path(alias, orig_url):
subprocess.call(cmd)
def main(args):
- global marks, prefix, dirname
+ global marks, prefix, gitdir, dirname
global tags, filenodes
global blob_marks
global parsed_refs
global files_cache
global is_tmp
+ global branches, peers
alias = args[1]
url = args[2]
@@ -743,6 +886,8 @@ def main(args):
parsed_refs = {}
files_cache = {}
marks = None
+ branches = {}
+ peers = {}
if alias[5:] == url:
is_tmp = True
diff --git a/contrib/remote-helpers/test-bzr.sh b/contrib/remote-helpers/test-bzr.sh
index 34666e1d0f..cec55f132e 100755
--- a/contrib/remote-helpers/test-bzr.sh
+++ b/contrib/remote-helpers/test-bzr.sh
@@ -228,4 +228,76 @@ test_expect_success 'push utf-8 filenames' '
test_cmp expected actual
'
+test_expect_success 'pushing a merge' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ (
+ bzr init bzrrepo &&
+ cd bzrrepo &&
+ echo one > content &&
+ bzr add content &&
+ bzr commit -m one
+ ) &&
+
+ git clone "bzr::$PWD/bzrrepo" gitrepo &&
+
+ (
+ cd bzrrepo &&
+ echo two > content &&
+ bzr commit -m two
+ ) &&
+
+ (
+ cd gitrepo &&
+ echo three > content &&
+ git commit -a -m three &&
+ git fetch &&
+ git merge origin/master || true &&
+ echo three > content &&
+ git commit -a --no-edit &&
+ git push
+ ) &&
+
+ echo three > expected &&
+ cat bzrrepo/content > actual &&
+ test_cmp expected actual
+'
+
+cat > expected <<EOF
+origin/HEAD
+origin/branch
+origin/trunk
+EOF
+
+test_expect_success 'proper bzr repo' '
+ mkdir -p tmp && cd tmp &&
+ test_when_finished "cd .. && rm -rf tmp" &&
+
+ bzr init-repo bzrrepo &&
+
+ bzr init bzrrepo/trunk &&
+ (
+ cd bzrrepo/trunk &&
+ echo one >> content &&
+ bzr add content &&
+ bzr commit -m one
+ ) &&
+
+ bzr branch bzrrepo/trunk bzrrepo/branch &&
+ (
+ cd bzrrepo/branch &&
+ echo two >> content &&
+ bzr commit -m one
+ ) &&
+
+ git clone "bzr::$PWD/bzrrepo" gitrepo &&
+ (
+ cd gitrepo &&
+ git for-each-ref --format "%(refname:short)" refs/remotes/origin > ../actual
+ ) &&
+
+ test_cmp ../expected actual
+'
+
test_done
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 048a140a6f..5822b2c592 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -57,6 +57,9 @@ rewritten="$state_dir"/rewritten
dropped="$state_dir"/dropped
+end="$state_dir"/end
+msgnum="$state_dir"/msgnum
+
# A script to set the GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, and
# GIT_AUTHOR_DATE that will be used for the commit that is currently
# being rebased.
@@ -109,7 +112,9 @@ mark_action_done () {
sed -e 1d < "$todo" >> "$todo".new
mv -f "$todo".new "$todo"
new_count=$(git stripspace --strip-comments <"$done" | wc -l)
+ echo $new_count >"$msgnum"
total=$(($new_count + $(git stripspace --strip-comments <"$todo" | wc -l)))
+ echo $total >"$end"
if test "$last_count" != "$new_count"
then
last_count=$new_count
diff --git a/perl/Git.pm b/perl/Git.pm
index dc48159cca..7a252ef872 100644
--- a/perl/Git.pm
+++ b/perl/Git.pm
@@ -1265,7 +1265,7 @@ sub _temp_cache {
$tmpdir = $self->repo_path();
}
- ($$temp_fd, $fname) = File::Temp->tempfile(
+ ($$temp_fd, $fname) = File::Temp::tempfile(
'Git_XXXXXX', UNLINK => 1, DIR => $tmpdir,
) or throw Error::Simple("couldn't open new temp file");
diff --git a/pretty.c b/pretty.c
index ba3148181e..9e431545d8 100644
--- a/pretty.c
+++ b/pretty.c
@@ -410,10 +410,7 @@ void pp_user_info(const struct pretty_print_context *pp,
const char *what, struct strbuf *sb,
const char *line, const char *encoding)
{
- struct strbuf name;
- struct strbuf mail;
struct ident_split ident;
- int linelen;
char *line_end;
const char *mailbuf, *namebuf;
size_t namelen, maillen;
@@ -422,18 +419,10 @@ void pp_user_info(const struct pretty_print_context *pp,
if (pp->fmt == CMIT_FMT_ONELINE)
return;
- line_end = strchr(line, '\n');
- if (!line_end) {
- line_end = strchr(line, '\0');
- if (!line_end)
- return;
- }
-
- linelen = ++line_end - line;
- if (split_ident_line(&ident, line, linelen))
+ line_end = strchrnul(line, '\n');
+ if (split_ident_line(&ident, line, line_end - line))
return;
-
mailbuf = ident.mail_begin;
maillen = ident.mail_end - ident.mail_begin;
namebuf = ident.name_begin;
@@ -442,43 +431,33 @@ void pp_user_info(const struct pretty_print_context *pp,
if (pp->mailmap)
map_user(pp->mailmap, &mailbuf, &maillen, &namebuf, &namelen);
- strbuf_init(&mail, 0);
- strbuf_init(&name, 0);
-
- strbuf_add(&mail, mailbuf, maillen);
- strbuf_add(&name, namebuf, namelen);
-
- namelen = name.len + mail.len + 3; /* ' ' + '<' + '>' */
-
if (pp->fmt == CMIT_FMT_EMAIL) {
strbuf_addstr(sb, "From: ");
- if (needs_rfc2047_encoding(name.buf, name.len, RFC2047_ADDRESS)) {
- add_rfc2047(sb, name.buf, name.len,
+ if (needs_rfc2047_encoding(namebuf, namelen, RFC2047_ADDRESS)) {
+ add_rfc2047(sb, namebuf, namelen,
encoding, RFC2047_ADDRESS);
max_length = 76; /* per rfc2047 */
- } else if (needs_rfc822_quoting(name.buf, name.len)) {
+ } else if (needs_rfc822_quoting(namebuf, namelen)) {
struct strbuf quoted = STRBUF_INIT;
- add_rfc822_quoted(&quoted, name.buf, name.len);
+ add_rfc822_quoted(&quoted, namebuf, namelen);
strbuf_add_wrapped_bytes(sb, quoted.buf, quoted.len,
-6, 1, max_length);
strbuf_release(&quoted);
} else {
- strbuf_add_wrapped_bytes(sb, name.buf, name.len,
+ strbuf_add_wrapped_bytes(sb, namebuf, namelen,
-6, 1, max_length);
}
- if (namelen - name.len + last_line_length(sb) > max_length)
- strbuf_addch(sb, '\n');
- strbuf_addf(sb, " <%s>\n", mail.buf);
+ if (max_length <
+ last_line_length(sb) + strlen(" <") + maillen + strlen(">"))
+ strbuf_addch(sb, '\n');
+ strbuf_addf(sb, " <%.*s>\n", (int)maillen, mailbuf);
} else {
- strbuf_addf(sb, "%s: %.*s%s <%s>\n", what,
- (pp->fmt == CMIT_FMT_FULLER) ? 4 : 0,
- " ", name.buf, mail.buf);
+ strbuf_addf(sb, "%s: %.*s%.*s <%.*s>\n", what,
+ (pp->fmt == CMIT_FMT_FULLER) ? 4 : 0, " ",
+ (int)namelen, namebuf, (int)maillen, mailbuf);
}
- strbuf_release(&mail);
- strbuf_release(&name);
-
switch (pp->fmt) {
case CMIT_FMT_MEDIUM:
strbuf_addf(sb, "Date: %s\n",
diff --git a/sha1_file.c b/sha1_file.c
index 64228a26d0..67e815b2db 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2128,7 +2128,6 @@ void *unpack_entry(struct packed_git *p, off_t obj_offset,
error("failed to unpack compressed delta "
"at offset %"PRIuMAX" from %s",
(uintmax_t)curpos, p->pack_name);
- free(base);
data = NULL;
continue;
}
diff --git a/t/t4300-merge-tree.sh b/t/t4300-merge-tree.sh
index 2defb422e8..9015e47654 100755
--- a/t/t4300-merge-tree.sh
+++ b/t/t4300-merge-tree.sh
@@ -259,6 +259,57 @@ EXPECTED
test_cmp expected actual
'
+test_expect_success 'tree add A, B (same)' '
+ cat >expect <<-\EOF &&
+ EOF
+ git reset --hard initial &&
+ mkdir sub &&
+ test_commit "add sub/file" "sub/file" "file" add-tree-A &&
+ git merge-tree initial add-tree-A add-tree-A >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'tree add A, B (different)' '
+ cat >expect <<-\EOF &&
+ added in both
+ our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
+ their 100644 ba629238ca89489f2b350e196ca445e09d8bb834 sub/file
+ @@ -1 +1,5 @@
+ +<<<<<<< .our
+ AAA
+ +=======
+ +BBB
+ +>>>>>>> .their
+ EOF
+ git reset --hard initial &&
+ mkdir sub &&
+ test_commit "add sub/file" "sub/file" "AAA" add-tree-a-b-A &&
+ git reset --hard initial &&
+ mkdir sub &&
+ test_commit "add sub/file" "sub/file" "BBB" add-tree-a-b-B &&
+ git merge-tree initial add-tree-a-b-A add-tree-a-b-B >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success 'tree unchanged A, removed B' '
+ cat >expect <<-\EOF &&
+ removed in remote
+ base 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
+ our 100644 43d5a8ed6ef6c00ff775008633f95787d088285d sub/file
+ @@ -1 +0,0 @@
+ -AAA
+ EOF
+ git reset --hard initial &&
+ mkdir sub &&
+ test_commit "add sub/file" "sub/file" "AAA" tree-remove-b-initial &&
+ git rm sub/file &&
+ test_tick &&
+ git commit -m "remove sub/file" &&
+ git tag tree-remove-b-B &&
+ git merge-tree tree-remove-b-initial tree-remove-b-initial tree-remove-b-B >actual &&
+ test_cmp expect actual
+'
+
test_expect_success 'turn file to tree' '
git reset --hard initial &&
rm initial-file &&
diff --git a/t/t5505-remote.sh b/t/t5505-remote.sh
index 6579a86724..dd10ff053c 100755
--- a/t/t5505-remote.sh
+++ b/t/t5505-remote.sh
@@ -1003,4 +1003,26 @@ test_expect_success 'remote set-url --delete baz' '
cmp expect actual
'
+test_expect_success 'extra args: setup' '
+ # add a dummy origin so that this does not trigger failure
+ git remote add origin .
+'
+
+test_extra_arg () {
+ test_expect_success "extra args: $*" "
+ test_must_fail git remote $* bogus_extra_arg 2>actual &&
+ grep '^usage:' actual
+ "
+}
+
+test_extra_arg add nick url
+test_extra_arg rename origin newname
+test_extra_arg remove origin
+test_extra_arg set-head origin master
+# set-branches takes any number of args
+test_extra_arg set-url origin newurl oldurl
+# show takes any number of args
+# prune takes any number of args
+# update takes any number of args
+
test_done
diff --git a/t/t5801-remote-helpers.sh b/t/t5801-remote-helpers.sh
index 69212cdde1..dbb02e2afd 100755
--- a/t/t5801-remote-helpers.sh
+++ b/t/t5801-remote-helpers.sh
@@ -186,4 +186,18 @@ test_expect_success GPG 'push signed tag with signed-tags capability' '
compare_refs local signed-tag-2 server signed-tag-2
'
+test_expect_success 'push messages' '
+ (cd local &&
+ git checkout -b new_branch master &&
+ echo new >>file &&
+ git commit -a -m new &&
+ git push origin new_branch &&
+ git fetch origin &&
+ echo new >>file &&
+ git commit -a -m new &&
+ git push origin new_branch 2> msg &&
+ ! grep "\[new branch\]" msg
+ )
+'
+
test_done
diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh
index e147a8d277..083b319ed1 100755
--- a/t/t9903-bash-prompt.sh
+++ b/t/t9903-bash-prompt.sh
@@ -28,6 +28,10 @@ test_expect_success 'setup for prompt tests' '
git checkout -b b2 master &&
echo 0 > file &&
git commit -m "second b2" file &&
+ echo 00 > file &&
+ git commit -m "another b2" file &&
+ echo 000 > file &&
+ git commit -m "yet another b2" file &&
git checkout master
'
@@ -243,10 +247,12 @@ test_expect_success 'prompt - inside bare repository' '
'
test_expect_success 'prompt - interactive rebase' '
- printf " (b1|REBASE-i)" > expected
+ printf " (b1|REBASE-i 2/3)" > expected
echo "#!$SHELL_PATH" >fake_editor.sh &&
cat >>fake_editor.sh <<\EOF &&
-echo "edit $(git log -1 --format="%h")" > "$1"
+echo "exec echo" > "$1"
+echo "edit $(git log -1 --format="%h")" >> "$1"
+echo "exec echo" >> "$1"
EOF
test_when_finished "rm -f fake_editor.sh" &&
chmod a+x fake_editor.sh &&
@@ -260,7 +266,7 @@ EOF
'
test_expect_success 'prompt - rebase merge' '
- printf " (b2|REBASE-m)" > expected &&
+ printf " (b2|REBASE-m 1/3)" > expected &&
git checkout b2 &&
test_when_finished "git checkout master" &&
test_must_fail git rebase --merge b1 b2 &&
@@ -270,7 +276,7 @@ test_expect_success 'prompt - rebase merge' '
'
test_expect_success 'prompt - rebase' '
- printf " ((t2)|REBASE)" > expected &&
+ printf " ((t2)|REBASE 1/3)" > expected &&
git checkout b2 &&
test_when_finished "git checkout master" &&
test_must_fail git rebase b1 b2 &&
diff --git a/transport-helper.c b/transport-helper.c
index 5f8d075ed8..835815f61d 100644
--- a/transport-helper.c
+++ b/transport-helper.c
@@ -806,6 +806,7 @@ static int push_refs_with_export(struct transport *transport,
if (private && !get_sha1(private, sha1)) {
strbuf_addf(&buf, "^%s", private);
string_list_append(&revlist_args, strbuf_detach(&buf, NULL));
+ hashcpy(ref->old_sha1, sha1);
}
free(private);