* Re: [PATCH] attr: fix off-by-one directory component length calculation
From: Jeff King @ 2013-01-15 23:24 UTC (permalink / raw)
To: Jean-Noël AVILA
Cc: Junio C Hamano, git, Nguyễn Thái Ngọc Duy
In-Reply-To: <7vfw222mv2.fsf@alter.siamese.dyndns.org>
On Tue, Jan 15, 2013 at 12:49:05PM -0800, Junio C Hamano wrote:
> "Jean-Noël AVILA" <avila.jn@gmail.com> writes:
>
> > Btw, the test 10 to t9902 is failing on my Debian testing. Is it a known
> > issue?
>
> Which branch?
t9902.10 is overly sensitive to extra git commands in your PATH, as well
as cruft in your build dir (especially if you have been building 'pu',
which has git-check-ignore). Try "make clean && make test".
-Peff
^ permalink raw reply
* Re: [PATCH 0/3] Fix a portability issue with git-cvsimport
From: Junio C Hamano @ 2013-01-15 23:43 UTC (permalink / raw)
To: Ben Walton; +Cc: esr, git
In-Reply-To: <1358291405-10173-1-git-send-email-bdwalton@gmail.com>
Ben Walton <bdwalton@gmail.com> writes:
> This patch series started as a quick fix for the use of %s and %z in
> git-cvsimport but grew slightly when I realized that the get_tz
> (get_tz_offset after this series) function used by Git::SVN didn't
> properly handle DST boundary conditions.
>
> I realize that Eric Raymond is working to deprecate the current
> iteration of git-cvsimport so this series may be only partially
> worthwhile. (If the cvsps 2 vs 3 issue does require a fallback
> git-cvsimport script then maybe the whole series is still valid?)
There is my reroll of Eric's patch [*1*], that is in 'pu'. The topic
ends at 12b3541 (t9600: adjust for new cvsimport, 2013-01-13).
I think the folks on the traditional Git side prefer the approach
taken by it to keep the old one under cvsimport-2 while adding
Eric's as cvsimport-3 and have a separate version switcher wrapper
[*2*, *3*]. Also Chris Rorvick, a contributor to cvsps-3 & new
cvsimport combo, who already has patches to Eric's version, agrees
that it is a foundation we can build on together [*4*].
Eric hasn't spoken on the topic yet, but I think what the rest of us
agreed may be a reasonable starting point.
I think I can apply your patches on top of 12b3541 with "am -3" and
have it automatically update git-cvsimport-2.perl ;-)
[References]
*1* http://thread.gmane.org/gmane.comp.version-control.git/213170/focus=213460
*2* http://thread.gmane.org/gmane.comp.version-control.git/213170/focus=213432
*3* http://thread.gmane.org/gmane.comp.version-control.git/213170/focus=213466
*4* http://thread.gmane.org/gmane.comp.version-control.git/213537/focus=213595
^ permalink raw reply
* Re: --simplify-merges returns too many references
From: Junio C Hamano @ 2013-01-15 23:48 UTC (permalink / raw)
To: Phil Hord; +Cc: git@vger.kernel.org
In-Reply-To: <CABURp0q0nhka+ivrs3+m+3C1N+FfTq2zJ=1rWp34tfGNQ3b30g@mail.gmail.com>
Phil Hord <phil.hord@gmail.com> writes:
> But with --simplify-merges, I see _more_ commits.
>
> $ git log --simplify-merges --oneline -- builtin/stripspace.c
> 634392b Add 'contrib/subtree/' from commit ...
> 497215d Update documentation for stripspace
> c2857fb stripspace: fix outdated comment
> 81b50f3 Move 'builtin-*' into a 'builtin/' subdirectory
> 610f043 Import branch 'git-p4' of git://repo.or.cz/fast-export
> b4d2b04 Merge git-gui
> 0a8f4f0 Merge git://git.kernel.org/pub/scm/git/gitweb
> 98e031f Merge git-tools repository under "tools" subdirectory
> 5569bf9 Do a cross-project merge of Paul Mackerras' gitk visualizer
After indenting away what should be shown, I notice all these extra
are merges without any common ancestors.
Just an observation; I didn't think things through.
^ permalink raw reply
* Re: [PATCH] remote-hg: fix handling of file perms when pushing
From: Junio C Hamano @ 2013-01-15 23:51 UTC (permalink / raw)
To: Max Horn; +Cc: git, Felipe Contreras
In-Reply-To: <1E49829A-0675-40D2-97C6-FD62982A0923@quendi.de>
Max Horn <max@quendi.de> writes:
> On 15.01.2013, at 14:02, Max Horn wrote:
>
>> Previously, when changing and committing an executable file, the file
>> would loose its executable bit on the hg side. Likewise, symlinks ended
>> up as "normal" files". This was not immediately apparent on the git side
>> unless one did a fresh clone.
>
> Sorry, forgot to sign off, please add:
>
> Signed-off-by: Max Horn <max@quendi.de>
>
> Max
Thanks; merged together with the other patch from Felipe to 'next'.
Unfortunately I noticed the "loose" typo (I think you meant "lose")
after I pushed out the results X-<.
^ permalink raw reply
* Re: [RFC/PATCH 2/8 v3] git_remote_helpers: fix input when running under Python 3
From: Pete Wyckoff @ 2013-01-16 0:03 UTC (permalink / raw)
To: John Keeping
Cc: Junio C Hamano, Michael Haggerty, git, Eric S. Raymond,
Felipe Contreras, Sverre Rabbelier
In-Reply-To: <20130115224049.GZ4574@serenity.lan>
john@keeping.me.uk wrote on Tue, 15 Jan 2013 22:40 +0000:
> This is what keeping the refs as byte strings looks like.
As John knows, it is not possible to interpret text from a byte
string without talking about the character encoding.
Git is (largely) a C program and uses the character set defined
in the C standard, which is a subset of ASCII. But git does
"math" on strings, like this snippet that takes something from
argv[] and prepends "refs/heads/":
strcpy(refname, "refs/heads/");
strcpy(refname + strlen("refs/heads/"), ret->name);
The result doesn't talk about what character set it is using,
but because it combines a prefix from ASCII with its input,
git makes the assumption that the input is ASCII-compatible.
If you feed a UTF-16 string in argv, e.g.
$ echo master | iconv -f ascii -t utf16 | xargs git branch
xargs: Warning: a NUL character occurred in the input. It cannot be passed through in the argument list. Did you mean to use the --null option?
fatal: Not a valid object name: ''.
you get an error about NUL, and not the branch you hoped for.
Git assumes that the input character set contains roughly ASCII
in byte positions 0..127.
That's one small reason why the useful character encodings put
ASCII in the 0..127 range, including utf-8, big5 and shift-jis.
ASCII is indeed special due to its legacy, and both C and Python
recognize this.
> diff --git a/git_remote_helpers/git/importer.py b/git_remote_helpers/git/importer.py
> @@ -18,13 +18,16 @@ class GitImporter(object):
>
> def get_refs(self, gitdir):
> """Returns a dictionary with refs.
> +
> + Note that the keys in the returned dictionary are byte strings as
> + read from git.
> """
> args = ["git", "--git-dir=" + gitdir, "for-each-ref", "refs/heads"]
> - lines = check_output(args).strip().split('\n')
> + lines = check_output(args).strip().split('\n'.encode('utf-8'))
> refs = {}
> for line in lines:
> - value, name = line.split(' ')
> - name = name.strip('commit\t')
> + value, name = line.split(' '.encode('utf-8'))
> + name = name.strip('commit\t'.encode('utf-8'))
> refs[name] = value
> return refs
I'd suggest for this Python conundrum using byte-string literals, e.g.:
lines = check_output(args).strip().split(b'\n')
value, name = line.split(b' ')
name = name.strip(b'commit\t')
Essentially identical to what you have, but avoids naming "utf-8" as
the encoding. It instead relies on Python's interpretation of
ASCII characters in string context, which is exactly what C does.
-- Pete
^ permalink raw reply
* real git pull grief
From: Jay Vee @ 2013-01-16 0:17 UTC (permalink / raw)
To: git
I have not changed any code and just tried to do a git pull and get
the following message:
Updating 527f1ee..18cf73e
error: Your local changes to the following files would be overwritten by merge:
java/..../Info.java
Please, commit your changes or stash them before you can merge.
Aborting
----------
I HAVE NOT CHANGED THIS FILE. It is telling me that my local
changes.... huh? I have not changed or modified the file.
----
When I do a $git status I see a lot of other files that begin with:
# modified: ....
<many of these>
How do I get out of this mess? I do not want to reset head. I want
to get back to the state where it does not think I have modified a
specific set of files... namely the files that I did not change.
How did I get into this state? How do I prevent from getting into
this state in the future? How do I get out of this state now?
thanks for all the help.
J.V.
^ permalink raw reply
* Re: real git pull grief
From: Jonathan Nieder @ 2013-01-16 0:20 UTC (permalink / raw)
To: Jay Vee; +Cc: git
In-Reply-To: <CADq_mb8LwzbjvaXGCR-6TZbTShf2nzw5wtNZ66_XmOM00-=xzQ@mail.gmail.com>
Hi Jay,
Jay Vee wrote:
> I HAVE NOT CHANGED THIS FILE. It is telling me that my local
> changes.... huh? I have not changed or modified the file.
>
> ----
> When I do a $git status I see a lot of other files that begin with:
>
> # modified: ....
> <many of these>
Two questions:
* what does "git diff" say?
* do you use Eclipse's git integration?
Curious,
Jonathan
^ permalink raw reply
* Re: real git pull grief
From: Jay Vee @ 2013-01-16 0:50 UTC (permalink / raw)
To: git
In-Reply-To: <20130116004534.GG12524@google.com>
git diff shows a list of files that I have made some changes to and
the diff for files that I have not changed.
The files I have made changes to (config files), I never want to
commit or push and sometimes I may want them overwritten. for now I
simply want to leave them there (changes to .sql files that are
specific to my environment).
What I want to know is why git is reporting that changes will be
overwritten to files that I have not touched or changed.
>> $git diff spews a lot of information.
>
> Just a representative first 20 lines or so would be fine. :)
>
> Jonathan
^ permalink raw reply
* Re: [PATCH] attr: fix off-by-one directory component length calculation
From: Duy Nguyen @ 2013-01-16 1:03 UTC (permalink / raw)
To: Jean-Noël AVILA; +Cc: git
In-Reply-To: <201301152014.28433.avila.jn@gmail.com>
On Wed, Jan 16, 2013 at 2:14 AM, Jean-Noël AVILA <avila.jn@gmail.com> wrote:
> I did not monitor the system calls when writing that patch.
> Where is the perf framework?
It's in t/perf. I think you can do:
./run HEAD .
to run and compare performance of HEAD and working directory (assume
you haven't commit yet). Check out the README file.
--
Duy
^ permalink raw reply
* Re: [RFC/PATCH] ignore memcmp() overreading in bsearch() callback
From: René Scharfe @ 2013-01-16 1:08 UTC (permalink / raw)
To: Andreas Schwab
Cc: Junio C Hamano, git, Jeff King, Carlos Martín Nieto,
Johannes Schindelin
In-Reply-To: <m2libunqdj.fsf@igel.home>
Am 15.01.2013 21:27, schrieb Andreas Schwab:
> René Scharfe <rene.scharfe@lsrfire.ath.cx> writes:
>
>> + return '\0' - ent->name[key->len];
>
> You need to cast to unsigned char first to make it consistent with
> memcmp and strcmp.
Thanks for catching this!
-- >8 --
Subject: [PATCH] refs: use strncmp() instead of strlen() and memcmp()
Simplify ref_entry_cmp_sslice() by using strncmp() to compare the
length-limited key and a NUL-terminated entry. While we're at it,
retain the const attribute of the input pointers.
Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
---
refs.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/refs.c b/refs.c
index 541fec2..5129da0 100644
--- a/refs.c
+++ b/refs.c
@@ -333,14 +333,12 @@ struct string_slice {
static int ref_entry_cmp_sslice(const void *key_, const void *ent_)
{
- struct string_slice *key = (struct string_slice *)key_;
- struct ref_entry *ent = *(struct ref_entry **)ent_;
- int entlen = strlen(ent->name);
- int cmplen = key->len < entlen ? key->len : entlen;
- int cmp = memcmp(key->str, ent->name, cmplen);
+ const struct string_slice *key = key_;
+ const struct ref_entry *ent = *(const struct ref_entry * const *)ent_;
+ int cmp = strncmp(key->str, ent->name, key->len);
if (cmp)
return cmp;
- return key->len - entlen;
+ return '\0' - (unsigned char)ent->name[key->len];
}
/*
--
1.8.0
^ permalink raw reply related
* Re: [PATCH] attr: fix off-by-one directory component length calculation
From: Duy Nguyen @ 2013-01-16 1:08 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jean-Noël AVILA, git
In-Reply-To: <7vwqve2qk3.fsf@alter.siamese.dyndns.org>
On Wed, Jan 16, 2013 at 2:29 AM, Junio C Hamano <gitster@pobox.com> wrote:
> "Jean-Noël AVILA" <avila.jn@gmail.com> writes:
>
>> Thank you for the explanation.
>>
>> I did not monitor the system calls when writing that patch.
>> Where is the perf framework?
>>
>> As the mistake is located in the "find_basename" function, I would propose a
>> fix directly into it so that the output fits what the other functions expect.
>
> Isn't that a crazy semantics for the function, though? I would
> expect find_basename("/a/path/to/file") to return "file", not
Actually I'd like to remove that function. The function is called twice:
- collect_all_attrs
+ prepare_attr_stack
* find_basename
+ find_basename
which could be reordered to
- collect_all_attrs
+ find_basename
+ prepare_attr_stack (modified to take dirlen from caller)
and because that'll be the only place find_basename is used, we could
just inline the code there.
--
Duy
^ permalink raw reply
* Re: What's cooking in git.git (Jan 2013, #06; Mon, 14)
From: Adam Spiers @ 2013-01-16 1:34 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
In-Reply-To: <7vehhn8kub.fsf@alter.siamese.dyndns.org>
On Mon, Jan 14, 2013 at 10:23 PM, Junio C Hamano <gitster@pobox.com> wrote:
> * as/check-ignore (2013-01-10) 12 commits
> (merged to 'next' on 2013-01-14 at 9df2afc)
> + t0008: avoid brace expansion
> + add git-check-ignore sub-command
> + setup.c: document get_pathspec()
> + add.c: extract new die_if_path_beyond_symlink() for reuse
> + add.c: extract check_path_for_gitlink() from treat_gitlinks() for reuse
> + pathspec.c: rename newly public functions for clarity
> + add.c: move pathspec matchers into new pathspec.c for reuse
> + add.c: remove unused argument from validate_pathspec()
> + dir.c: improve docs for match_pathspec() and match_pathspec_depth()
> + dir.c: provide clear_directory() for reclaiming dir_struct memory
> + dir.c: keep track of where patterns came from
> + dir.c: use a single struct exclude_list per source of excludes
>
> Add a new command "git check-ignore" for debugging .gitignore
> files.
The above is v4 plus the "t0008: avoid brace expansion" fix. v4 is
slightly outdated and not quite the right version to merge to 'next'.
I'll post a v5 re-roll as per:
http://thread.gmane.org/gmane.comp.version-control.git/212184/focus=212856
in the next 24 hours or so.
I think the "t0008: avoid brace expansion" fix at the tip should
probably be squashed into its parent. I've amended the commit message
accordingly in my github fork.
Thanks,
Adam
^ permalink raw reply
* Re: [PATCH 3/3] Avoid non-portable strftime format specifiers in git-cvsimport
From: Chris Rorvick @ 2013-01-16 1:53 UTC (permalink / raw)
To: Ben Walton; +Cc: gitster, esr, git
In-Reply-To: <1358291405-10173-4-git-send-email-bdwalton@gmail.com>
On Tue, Jan 15, 2013 at 5:10 PM, Ben Walton <bdwalton@gmail.com> wrote:
> Neither %s or %z are portable strftime format specifiers. There is no
> need for %s in git-cvsimport as the supplied time is already in
> seconds since the epoch. For %z, use the function get_tz_offset
> provided by Git.pm instead.
Out of curiosity, which platforms are affected? Assuming DST is a 1
hour shift (patch 2/3) is not necessarily portable either, though this
currently appears to only affect a small island off of the coast of
Australia. :-)
Chris
^ permalink raw reply
* Re: [PATCH] attr: fix off-by-one directory component length calculation
From: Duy Nguyen @ 2013-01-16 2:09 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Jean-Noël AVILA, git
In-Reply-To: <CACsJy8Bn4GKJzi4n5cMPp+26dovT795nUqcXGNLgapf+r_PFCw@mail.gmail.com>
On Wed, Jan 16, 2013 at 08:08:03AM +0700, Duy Nguyen wrote:
> Actually I'd like to remove that function.
This is what I had in mind:
-- 8< --
Subject: [PATCH] attr: avoid calling find_basename() twice per path
find_basename() is only used inside collect_all_attrs(), called once
in prepare_attr_stack, then again after prepare_attr_stack()
returns. Both calls return exact same value. Reorder the code to do it
once.
While at it, make use of "pathlen" to stop searching early if
possible.
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
attr.c | 46 +++++++++++++++++++---------------------------
1 file changed, 19 insertions(+), 27 deletions(-)
diff --git a/attr.c b/attr.c
index cfc6748..04cb9a0 100644
--- a/attr.c
+++ b/attr.c
@@ -564,32 +564,12 @@ static void bootstrap_attr_stack(void)
attr_stack = elem;
}
-static const char *find_basename(const char *path)
-{
- const char *cp, *last_slash = NULL;
-
- for (cp = path; *cp; cp++) {
- if (*cp == '/' && cp[1])
- last_slash = cp;
- }
- return last_slash ? last_slash + 1 : path;
-}
-
-static void prepare_attr_stack(const char *path)
+static void prepare_attr_stack(const char *path, int dirlen)
{
struct attr_stack *elem, *info;
- int dirlen, len;
+ int len;
const char *cp;
- dirlen = find_basename(path) - path;
-
- /*
- * find_basename() includes the trailing slash, but we do
- * _not_ want it.
- */
- if (dirlen)
- dirlen--;
-
/*
* At the bottom of the attribute stack is the built-in
* set of attribute definitions, followed by the contents
@@ -769,15 +749,27 @@ static int macroexpand_one(int attr_nr, int rem)
static void collect_all_attrs(const char *path)
{
struct attr_stack *stk;
- int i, pathlen, rem;
- const char *basename;
+ int i, pathlen, rem, dirlen = 0;
+ const char *basename = path, *cp;
- prepare_attr_stack(path);
+ pathlen = strlen(path);
+
+ /*
+ * This loop is similar to strrchr(path, '/') except that the
+ * trailing slash is skipped.
+ */
+ for (cp = path + pathlen - 2; cp >= path; cp--) {
+ if (*cp == '/') {
+ basename = cp + 1;
+ dirlen = cp - path;
+ break;
+ }
+ }
+
+ prepare_attr_stack(path, dirlen);
for (i = 0; i < attr_nr; i++)
check_all_attr[i].value = ATTR__UNKNOWN;
- basename = find_basename(path);
- pathlen = strlen(path);
rem = attr_nr;
for (stk = attr_stack; 0 < rem && stk; stk = stk->prev)
rem = fill(path, pathlen, basename, stk, rem);
--
1.8.0.rc3.18.g0d9b108
-- 8< --
^ permalink raw reply related
* [PATCH 1/3] t5550: do not assume the "matching" push is the default
From: Brian Gernhardt @ 2013-01-16 2:05 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Brian Gernhardt
In-Reply-To: <cover.1358301792.git.brian@gernhardtsoftware.com>
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
---
t/t5550-http-fetch.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t5550-http-fetch.sh b/t/t5550-http-fetch.sh
index 80d20c8..f7d0f14 100755
--- a/t/t5550-http-fetch.sh
+++ b/t/t5550-http-fetch.sh
@@ -13,6 +13,7 @@ LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5550'}
start_httpd
test_expect_success 'setup repository' '
+ git config push.default matching &&
echo content1 >file &&
git add file &&
git commit -m one
--
1.8.1.rc1.222.gec797b3
^ permalink raw reply related
* [PATCH 2/3] t5551: do not assume the "matching" push is the default
From: Brian Gernhardt @ 2013-01-16 2:05 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Brian Gernhardt
In-Reply-To: <cover.1358301792.git.brian@gernhardtsoftware.com>
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
---
t/t5551-http-fetch.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t5551-http-fetch.sh b/t/t5551-http-fetch.sh
index c5cd2e3..1b55086 100755
--- a/t/t5551-http-fetch.sh
+++ b/t/t5551-http-fetch.sh
@@ -13,6 +13,7 @@ LIB_HTTPD_PORT=${LIB_HTTPD_PORT-'5551'}
start_httpd
test_expect_success 'setup repository' '
+ git config push.default matching &&
echo content >file &&
git add file &&
git commit -m one
--
1.8.1.rc1.222.gec797b3
^ permalink raw reply related
* [PATCH 3/3] t5570: do not assume the "matching" push is the default
From: Brian Gernhardt @ 2013-01-16 2:05 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Brian Gernhardt
In-Reply-To: <cover.1358301792.git.brian@gernhardtsoftware.com>
Signed-off-by: Brian Gernhardt <brian@gernhardtsoftware.com>
---
t/t5570-git-daemon.sh | 1 +
1 file changed, 1 insertion(+)
diff --git a/t/t5570-git-daemon.sh b/t/t5570-git-daemon.sh
index a3a4e47..f01edff 100755
--- a/t/t5570-git-daemon.sh
+++ b/t/t5570-git-daemon.sh
@@ -8,6 +8,7 @@ LIB_GIT_DAEMON_PORT=${LIB_GIT_DAEMON_PORT-5570}
start_git_daemon
test_expect_success 'setup repository' '
+ git config push.default matching &&
echo content >file &&
git add file &&
git commit -m one
--
1.8.1.rc1.222.gec797b3
^ permalink raw reply related
* [PATCH 0/3] Update HTTPD/daemon tests for new push.default
From: Brian Gernhardt @ 2013-01-16 2:05 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Brian Gernhardt
I saw a string of these commits already, but found a few more when running
the test suite.
Brian Gernhardt (3):
t5550: do not assume the "matching" push is the default
t5551: do not assume the "matching" push is the default
t5570: do not assume the "matching" push is the default
t/t5550-http-fetch.sh | 1 +
t/t5551-http-fetch.sh | 1 +
t/t5570-git-daemon.sh | 1 +
3 files changed, 3 insertions(+)
--
1.8.1.rc1.222.gec797b3
^ permalink raw reply
* [PATCH 0/7] guilt patches, including git 1.8 support
From: Jonathan Nieder @ 2013-01-16 2:26 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
Hi Jeff and other guilty parties,
I collected all the guilt patches I could find on-list and added one
of my own. Completely untested, except for running the regression
tests. These are also available via git protocol from
git://repo.or.cz/guilt/mob.git mob
Thoughts?
Jonathan Nieder (1):
Drop unneeded git version check.
Per Cederqvist (6):
get rid of "cat: write error: Broken pipe" error message
The tests should not fail if log.date or log.decorate are set.
Testsuite: get rid of "Broken pipe" errors from yes.
Handle empty patches and patches with only a header.
Fix fatal "guilt graph" error in sha1sum invocation.
Change git branch when patches are applied.
Documentation/guilt.7 | 4 +
guilt | 73 +++++---
guilt-branch | 12 +-
guilt-commit | 7 +
guilt-import-commit | 4 +-
guilt-repair | 7 +-
os.Darwin | 7 +-
os.Linux | 7 +-
os.SunOS | 7 +-
regression/scaffold | 7 +-
regression/t-029.sh | 6 +-
regression/t-052.out | 24 +--
regression/t-052.sh | 7 +-
regression/t-061.out | 468 ++++++++++++++++++++++++++++++++++++++++++++++++++
regression/t-061.sh | 148 ++++++++++++++++
15 files changed, 743 insertions(+), 45 deletions(-)
create mode 100644 regression/t-061.out
create mode 100755 regression/t-061.sh
^ permalink raw reply
* [GUILT] [PATCH 1/7] get rid of "cat: write error: Broken pipe" error message
From: Jonathan Nieder @ 2013-01-16 2:27 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Tue, 13 Mar 2012 14:39:44 +0100
In some circumstances (like running guilt in a M-x shell buffer in
Emacs) cat may give the above error message when the reader of the
output from cat exits without reading all input from cat. (In other
circumstances cat is just silently terminated with SIGPIPE.)
Get rid of the error by removing the useless use of cat in
do_get_header and do_get_full_header.
Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
guilt | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/guilt b/guilt
index d1e17d4..7f6806e 100755
--- a/guilt
+++ b/guilt
@@ -359,7 +359,7 @@ do_get_header()
# 4th line skips any empty lines thereafter.
# 5th line turns off empty line skip upon seeing a non-empty line.
# 6th line terminates execution when we encounter the diff
- cat "$1" | awk '
+ awk '
BEGIN{body=0; subj=0}
/^Subject:/ && (body == 0 && subj == 0){subj=1; print substr($0, 10) "\n"; next}
/^(Subject:|From:|Author:|Date:|commit)/ && (body == 0){next}
@@ -369,7 +369,7 @@ BEGIN{body=0; subj=0}
/^(diff |---$|--- )/{exit}
{print $0}
END{}
-'
+' < "$1"
}
# usage: do_get_full_header patchfile
@@ -377,12 +377,12 @@ do_get_full_header()
{
# 2nd line checks for the begining of a patch
# 3rd line outputs the line if it didn't get pruned by the above rules
- cat "$1" | awk '
+ awk '
BEGIN{}
/^(diff |---$|--- )/{exit}
{print $0}
END{}
-'
+' < "$1"
}
# usage: assert_head_check
--
1.8.1
^ permalink raw reply related
* [GUILT] [PATCH 2/7] The tests should not fail if log.date or log.decorate are set.
From: Jonathan Nieder @ 2013-01-16 2:27 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Mon, 30 Apr 2012 12:25:49 +0200
Explicitly set log.date and log.decorate to their Git default values,
so that git produces the expected output even if log.date and
log.decorate are set by the user in his .gitconfig.
Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
regression/scaffold | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/regression/scaffold b/regression/scaffold
index 8769058..9db79a9 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -82,6 +82,10 @@ function setup_git_repo
git add def
git commit -s -m "initial" 2> /dev/null > /dev/null
# the commit should be d4850419ccc1146c7169f500725ce504b9774ed0
+
+ # Explicitly set config that the tests rely on.
+ git config log.date default
+ git config log.decorate no
}
function setup_guilt_repo
--
1.8.1
^ permalink raw reply related
* [GUILT] [PATCH 3/7] Testsuite: get rid of "Broken pipe" errors from yes.
From: Jonathan Nieder @ 2013-01-16 2:28 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Mon, 30 Apr 2012 12:27:21 +0200
Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
regression/t-029.sh | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/regression/t-029.sh b/regression/t-029.sh
index 83e1d2b..09450c6 100755
--- a/regression/t-029.sh
+++ b/regression/t-029.sh
@@ -21,11 +21,11 @@ echo | shouldfail guilt repair --full
cmd list_files
-yes n | shouldfail guilt repair --full
+yes n 2>/dev/null | shouldfail guilt repair --full
cmd list_files
-yes y | cmd guilt repair --full
+yes y 2>/dev/null | cmd guilt repair --full
cmd list_files
@@ -33,6 +33,6 @@ cmd guilt push -a
cmd list_files
-yes Y | cmd guilt repair --full
+yes Y 2>/dev/null | cmd guilt repair --full
cmd list_files
--
1.8.1
^ permalink raw reply related
* [GUILT] [PATCH 4/7] Handle empty patches and patches with only a header.
From: Jonathan Nieder @ 2013-01-16 2:28 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Mon, 30 Apr 2012 12:29:55 +0200
"git apply --numstat" in Git 1.7.10 gives an error message unless the
patch contains a diff, so don't attempt to apply it unless we find a
'^diff'.
Signed-off-by: Per Cederqvist <cederp@opera.com>
Acked-by: Jeff Sipek <jeffpc@josefsipek.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
guilt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/guilt b/guilt
index 7f6806e..5bcc498 100755
--- a/guilt
+++ b/guilt
@@ -611,7 +611,7 @@ push_patch()
cd_to_toplevel
# apply the patch if and only if there is something to apply
- if [ `git apply --numstat "$p" | wc -l` -gt 0 ]; then
+ if grep -q '^diff ' "$p" && [ `git apply --numstat "$p" | wc -l` -gt 0 ]; then
if [ "$bail_action" = abort ]; then
reject=""
fi
--
1.8.1
^ permalink raw reply related
* [GUILT] [PATCH 5/7] Fix fatal "guilt graph" error in sha1sum invocation.
From: Jonathan Nieder @ 2013-01-16 2:29 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Wed, 14 Mar 2012 14:34:38 +0100
Fix the compatibility function sha1 so that it reads from
stdin (and not a file with a zero-length file name) when
no argument is supplied.
[jn: adapted to also handle newer versions of OpenSSL,
based on reports from Andreas Schwab and John Szakmeister.
$ openssl dgst -sha1</dev/null
da39a3ee5e6b4b0d3255bfef95601890afd80709
$ openssl version
OpenSSL 0.9.8o 01 Jun 2010
$ openssl dgst -sha1 </dev/null
(stdin)= da39a3ee5e6b4b0d3255bfef95601890afd80709
$ openssl version
OpenSSL 1.0.0d 8 Feb 2011
]
Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
os.Darwin | 7 ++++++-
os.Linux | 7 ++++++-
os.SunOS | 7 ++++++-
3 files changed, 18 insertions(+), 3 deletions(-)
diff --git a/os.Darwin b/os.Darwin
index 470f5fb..3f23121 100644
--- a/os.Darwin
+++ b/os.Darwin
@@ -27,7 +27,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2 \1,"
+ if [ $# = 1 ]
+ then
+ openssl dgst -sha1 "$1" | sed "s,SHA1.\(.*\).= \(.*\),\2 \1,"
+ else
+ openssl dgst -sha1 | sed 's,\(.*= \)*\(.*\),\2 -,'
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.Linux b/os.Linux
index 30b9cb0..aaebf88 100644
--- a/os.Linux
+++ b/os.Linux
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
diff --git a/os.SunOS b/os.SunOS
index 30b9cb0..aaebf88 100644
--- a/os.SunOS
+++ b/os.SunOS
@@ -30,7 +30,12 @@ head_n()
# usage: sha1 [file]
sha1()
{
- sha1sum "$1"
+ if [ $# = 1 ]
+ then
+ sha1sum "$1"
+ else
+ sha1sum
+ fi
}
# usage: cp_a <src> <dst>
--
1.8.1
^ permalink raw reply related
* [GUILT] [PATCH 6/7] Change git branch when patches are applied.
From: Jonathan Nieder @ 2013-01-16 2:30 UTC (permalink / raw)
To: Josef 'Jeff' Sipek
Cc: git, Per Cederqvist, Theodore Ts'o, Iulian Udrea,
Axel Beckert
In-Reply-To: <20130116022606.GI12524@google.com>
From: Per Cederqvist <cederp@opera.com>
Date: Mon, 30 Apr 2012 12:24:06 +0200
Apply patches on a separate branch. The separate branch is
automatically created when Guilt pushes something, and removed when no
patches are applied. The name is formed by prepending "guilt/" to the
original branch.
This breaks the "upstream" relationship, so a mistaken "git push"
while patches are applied will no longer mess up your upstream
repository.
Update the testsuite and documentation.
Thanks to Junio C Hamano for suggesting this solution to my problem.
Signed-off-by: Per Cederqvist <cederp@opera.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
---
This one was a bit experimental if I remember correctly, so you may
want to skip it or make the feature optional.
Documentation/guilt.7 | 4 +
guilt | 52 +++++-
guilt-branch | 12 +-
guilt-commit | 7 +
guilt-import-commit | 4 +-
guilt-repair | 7 +-
regression/scaffold | 3 +-
regression/t-052.out | 24 +--
regression/t-052.sh | 7 +-
regression/t-061.out | 468 ++++++++++++++++++++++++++++++++++++++++++++++++++
regression/t-061.sh | 148 ++++++++++++++++
11 files changed, 713 insertions(+), 23 deletions(-)
create mode 100644 regression/t-061.out
create mode 100755 regression/t-061.sh
diff --git a/Documentation/guilt.7 b/Documentation/guilt.7
index 860e6d6..c3fdb3d 100644
--- a/Documentation/guilt.7
+++ b/Documentation/guilt.7
@@ -43,6 +43,10 @@ guards: This file contains any guards that should be applied to the series when
series: This file contains a list of all the patch filenames relative to the per\-branch patch directory\&. Empty and commented out lines are ignored\&.
status: This file contains the state of the stack\&. What patches are applied\&.
+.SH "BRANCH USAGE"
+When you have pushed a patch, Guilt automatically changes to a freshly created Git branch\&. The name of the new branch is formed by prepending \fBguilt/\fR to the name of the original branch\&. This is done so that you do not accidentally push a set of Guilt patches to a remote Git repository\&. Once you pop all patches Guilt automatically changes back to the original branch\&.
+
+This is mostly transparent\&. The only thing you need to remember is that if you use \fBgit checkout\fR to switch to a branch while you have Guilt patches applied, you should use \fBgit checkout guilt/BRANCH\fR instead of \fBgit checkout BRANCH\fR when you want to change back later.
.SH "HOOKS"
Any guilt operation may execute zero or more hook scripts which can be used to run any housekeeping commands or even abort the execution of the command\&.
.SH "HOOKS DIRECTORY"
diff --git a/guilt b/guilt
index 5bcc498..66a671a 100755
--- a/guilt
+++ b/guilt
@@ -408,9 +408,9 @@ head_check()
return 0 ;;
esac
- if [ "`git rev-parse refs/heads/$branch`" != "`git rev-parse $1`" ]; then
+ if [ "`git rev-parse refs/heads/\`git_branch\``" != "`git rev-parse $1`" ]; then
disp "Expected HEAD commit $1" >&2
- disp " got `git rev-parse refs/heads/$branch`" >&2
+ disp " got `git rev-parse refs/heads/\`git_branch\``" >&2
return 1
fi
return 0
@@ -500,6 +500,11 @@ pop_many_patches()
n=`expr $n - $2`
head_n "$n" < "$applied" > "$applied.tmp"
mv "$applied.tmp" "$applied"
+ if [ -z "`get_top 2>/dev/null`" ] && [ "`git symbolic-ref HEAD`" = "refs/heads/$GUILT_PREFIX$branch" ] && ! $old_style_prefix
+ then
+ git symbolic-ref HEAD refs/heads/$branch
+ git update-ref -d refs/heads/$GUILT_PREFIX$branch
+ fi
)
}
@@ -585,7 +590,13 @@ commit()
# commit
treeish=`git write-tree`
commitish=`git commit-tree $treeish -p $2 < "$TMP_MSG"`
- git update-ref HEAD $commitish
+ if $old_style_prefix || git rev-parse --verify --quiet refs/heads/$GUILT_PREFIX$branch >/dev/null
+ then
+ git update-ref HEAD $commitish
+ else
+ git branch $GUILT_PREFIX$branch $commitish
+ git symbolic-ref HEAD refs/heads/$GUILT_PREFIX$branch
+ fi
# mark patch as applied
git update-ref "refs/patches/$branch/$pname" HEAD
@@ -825,6 +836,9 @@ guilt_push_diff_context=1
# default diffstat value: true or false
DIFFSTAT_DEFAULT="false"
+# Prefix for guilt branches.
+GUILT_PREFIX=guilt/
+
#
# Parse any part of .git/config that belongs to us
#
@@ -839,7 +853,28 @@ diffstat=`git config --bool guilt.diffstat`
GUILT_DIR="$GIT_DIR/patches"
-branch=`get_branch`
+# To make it harder to accidentally do "git push" with a guilt patch
+# applied, "guilt push" changes branch from e.g. "master" to
+# "guilt/master". Set $git_branch to the full branch name, and
+# $branch to the abbreviated name that the user sees most of the time.
+# Note: old versions of guilt did not add the "guilt/" prefix. This
+# code handles that case as well. The prefix will be added when you
+# have no patches applied and do a "guilt push".
+raw_git_branch=`get_branch`
+branch=`echo "$raw_git_branch" | sed -e 's,^'$GUILT_PREFIX',,'`
+
+git_branch()
+{
+ if $old_style_prefix
+ then
+ echo $branch
+ elif [ -z "`get_top 2>/dev/null`" ]
+ then
+ echo $branch
+ else
+ echo $GUILT_PREFIX$branch
+ fi
+}
# most of the time we want to verify that the repo's branch has been
# initialized, but every once in a blue moon (e.g., we want to run guilt init),
@@ -876,4 +911,13 @@ else
die "Unsupported operating system: $UNAME_S"
fi
+if [ "$branch" = "$raw_git_branch" ] && [ -n "`get_top 2>/dev/null`" ]
+then
+ # This is for compat with old repositories that still have a
+ # pushed patch without the new-style branch prefix.
+ old_style_prefix=true
+else
+ old_style_prefix=false
+fi
+
_main "$@"
diff --git a/guilt-branch b/guilt-branch
index 909f740..4a1f53e 100755
--- a/guilt-branch
+++ b/guilt-branch
@@ -35,8 +35,16 @@ cat "$applied" | while read n; do
`git rev-parse "refs/patches/$branch/$n"` ""
done
-git branch "$newbranch"
-git checkout "$newbranch"
+if $old_style_prefix || [ -z "`get_top 2>/dev/null`" ]
+then
+ newgitbranch="$newbranch"
+else
+ git update-ref "refs/heads/$newbranch" "refs/heads/$branch" ""
+ newgitbranch="$GUILT_PREFIX$newbranch"
+fi
+
+git branch "$newgitbranch"
+git checkout "$newgitbranch"
mkdir -p "$GUILT_DIR/`dirname $newbranch`"
diff --git a/guilt-commit b/guilt-commit
index 4228be6..e425399 100755
--- a/guilt-commit
+++ b/guilt-commit
@@ -43,4 +43,11 @@ done
sed -n -e "${pat_keep}" "$applied" > "$applied.tmp"
mv "$applied.tmp" "$applied"
+# if we removed the last patch, switch back to the base branch
+if [ `wc -l < "$applied"` -eq 0 ] && [ "`git symbolic-ref HEAD`" = "refs/heads/$GUILT_PREFIX$branch" ] && ! $old_style_prefix
+then
+ git update-ref refs/heads/$branch refs/heads/$GUILT_PREFIX$branch
+ git symbolic-ref HEAD refs/heads/$branch
+ git update-ref -d refs/heads/$GUILT_PREFIX$branch
+fi
}
diff --git a/guilt-import-commit b/guilt-import-commit
index 3045a5f..54c1de0 100755
--- a/guilt-import-commit
+++ b/guilt-import-commit
@@ -23,7 +23,7 @@ if ! must_commit_first; then
fi
disp "About to begin conversion..." >&2
-disp "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2
+disp "Current head: `cat $GIT_DIR/refs/heads/\`git_branch\``" >&2
for rev in `git rev-list $rhash`; do
s=`git log --pretty=oneline -1 $rev | cut -c 42-`
@@ -68,6 +68,6 @@ for rev in `git rev-list $rhash`; do
done
disp "Done." >&2
-disp "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2
+disp "Current head: `cat $GIT_DIR/refs/heads/\`git_branch\``" >&2
}
diff --git a/guilt-repair b/guilt-repair
index 77ad223..c0bf3ed 100755
--- a/guilt-repair
+++ b/guilt-repair
@@ -84,6 +84,11 @@ repair_pushed()
# blow away any commits
git reset --hard "$newrev" > /dev/null
+ if [ "`git symbolic-ref HEAD`" = "refs/heads/$GUILT_PREFIX$branch" ] && ! $old_style_prefix
+ then
+ git symbolic-ref HEAD refs/heads/$branch
+ git update-ref -d refs/heads/$GUILT_PREFIX$branch
+ fi
# blow away the applied stack
remove_patch_refs < "$applied"
@@ -112,7 +117,7 @@ case "$1" in
;;
esac
-oldrev=`git show-ref -s "refs/heads/$branch"`
+oldrev=`git show-ref -s "refs/heads/\`git_branch\`"`
case "$repair" in
full)
diff --git a/regression/scaffold b/regression/scaffold
index 9db79a9..546d8c6 100644
--- a/regression/scaffold
+++ b/regression/scaffold
@@ -38,7 +38,8 @@ function replace_path
-e "s,^Usage: guilt-,Usage: guilt ,g" \
-e "s,\.\.\. initial, initial,g" \
-e "s,^Already on\( branch\)\? [\"']\([^\"']*\)[\"']$,Already on \"\2\",g" \
- -e "s,^Switched to branch [\"']\([^\"']*\)[\"'],Switched to branch \"\1\",g"
+ -e "s,^Switched to branch [\"']\([^\"']*\)[\"'],Switched to branch \"\1\",g" \
+ -e "\\,^Deleted branch guilt/.* (was .*).$,d"
}
function filter_dd
diff --git a/regression/t-052.out b/regression/t-052.out
index 3b4a629..8205f35 100644
--- a/regression/t-052.out
+++ b/regression/t-052.out
@@ -47,7 +47,7 @@ f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
Applying patch..modify
Patch applied.
% guilt branch br-modify
-Switched to branch "br-modify"
+Switched to branch "guilt/br-modify"
% list_files
d .git/patches
d .git/patches/br-
@@ -76,8 +76,8 @@ f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/br-/status
r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/br-modify/modify
r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
-% git checkout master
-Switched to branch "master"
+% git checkout guilt/master
+Switched to branch "guilt/master"
% list_files
d .git/patches
d .git/patches/br-
@@ -109,7 +109,7 @@ r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
Applying patch..add
Patch applied.
% guilt branch br-add
-Switched to branch "br-add"
+Switched to branch "guilt/br-add"
% list_files
d .git/patches
d .git/patches/br-
@@ -149,8 +149,8 @@ r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/br-modify/modify
r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/br-add/add
r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
-% git checkout master
-Switched to branch "master"
+% git checkout guilt/master
+Switched to branch "guilt/master"
% list_files
d .git/patches
d .git/patches/br-
@@ -193,7 +193,7 @@ r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
Applying patch..remove
Patch applied.
% guilt branch br-remove
-Switched to branch "br-remove"
+Switched to branch "guilt/br-remove"
% list_files
d .git/patches
d .git/patches/br-
@@ -245,8 +245,8 @@ r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/br-remove/add
r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/br-remove/remove
r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
-% git checkout master
-Switched to branch "master"
+% git checkout guilt/master
+Switched to branch "guilt/master"
% list_files
d .git/patches
d .git/patches/br-
@@ -301,7 +301,7 @@ r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
Applying patch..mode
Patch applied.
% guilt branch br-mode
-Switched to branch "br-mode"
+Switched to branch "guilt/br-mode"
% list_files
d .git/patches
d .git/patches/br-
@@ -366,5 +366,5 @@ r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba .git/refs/patches/master/mode
r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/br-mode/remove
r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/br-remove/remove
r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
-% git checkout master
-Switched to branch "master"
+% git checkout guilt/master
+Switched to branch "guilt/master"
diff --git a/regression/t-052.sh b/regression/t-052.sh
index e9c1a59..05bc55b 100755
--- a/regression/t-052.sh
+++ b/regression/t-052.sh
@@ -12,5 +12,10 @@ for x in "" modify add remove mode ; do
[ "$x" != "" ] && guilt push "$x"
cmd guilt branch br-$x
cmd list_files
- cmd git checkout master
+ if [ "$x" != "" ]
+ then
+ cmd git checkout guilt/master
+ else
+ cmd git checkout master
+ fi
done
diff --git a/regression/t-061.out b/regression/t-061.out
new file mode 100644
index 0000000..8365236
--- /dev/null
+++ b/regression/t-061.out
@@ -0,0 +1,468 @@
+% setup_repo
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8 .git/patches/master/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba .git/refs/patches/master/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% git update-ref refs/heads/master refs/heads/guilt/master
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8 .git/patches/master/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba .git/refs/patches/master/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
+% guilt pop
+Now at remove.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt push
+Applying patch..mode
+Patch applied.
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt pop
+Now at remove.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt pop
+Now at add.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt push
+Applying patch..remove
+Patch applied.
+% git for-each-ref
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt pop
+Now at add.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt pop
+Now at modify.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt push
+Applying patch..add
+Patch applied.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt pop
+Now at modify.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% guilt pop
+No patches applied.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% guilt pop
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% git update-ref refs/heads/master refs/heads/guilt/master
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt pop -a
+All patches popped.
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% guilt push add
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+% git update-ref refs/heads/master refs/heads/guilt/master
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/master
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/topic/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/topic/modify
+% guilt pop -a
+All patches popped.
+% guilt push
+Applying patch..modify
+Patch applied.
+% git for-each-ref
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/heads/guilt/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/topic/modify
+% guilt pop -a
+All patches popped.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% git update-ref refs/heads/master refs/heads/guilt/master
+% git symbolic-ref HEAD refs/heads/master
+% git update-ref -d refs/heads/guilt/master
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/master
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/topic/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/topic/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/topic/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/topic/remove
+% guilt pop -a
+All patches popped.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
+% guilt branch topic
+Switched to branch "topic"
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/topic
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/patches/topic
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/topic/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/topic/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/topic/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/topic/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/topic/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/topic/status
+% guilt pop -a
+No patches applied.
+% git checkout master
+Switched to branch "master"
+% guilt pop -a
+No patches applied.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% guilt branch topic
+Switched to branch "guilt/topic"
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/guilt/master
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/guilt/topic
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/topic/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/topic/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/topic/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/topic/remove
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/patches/topic
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/topic/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/topic/remove
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8 .git/patches/master/status
+f 71596bf71b72c2717e1aee378aabefbfa19ab7c8 .git/patches/topic/status
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/topic/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/topic/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/topic/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/master/modify
+r 33633e7a1aa31972f125878baf7807be57b1672d .git/refs/patches/topic/modify
+r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/master/add
+r 37d588cc39848368810e88332bd03b083f2ce3ac .git/refs/patches/topic/add
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba .git/refs/patches/master/mode
+r ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba .git/refs/patches/topic/mode
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/master/remove
+r ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 .git/refs/patches/topic/remove
+% guilt pop -a
+All patches popped.
+% git for-each-ref
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/topic
+37d588cc39848368810e88332bd03b083f2ce3ac commit refs/patches/master/add
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba commit refs/patches/master/mode
+33633e7a1aa31972f125878baf7807be57b1672d commit refs/patches/master/modify
+ffb7faa126a6d91bcdd44a494f76b96dd860b8b9 commit refs/patches/master/remove
+% guilt pop -a
+No patches applied.
+ccd56089d1b5305a9d35617cb7f6f4b06ffa68ba
+% git checkout guilt/master
+Switched to branch "guilt/master"
+% guilt pop -a
+All patches popped.
+% git branch -d topic
+Deleted branch topic (was d485041).
+% rm -r .git/patches/topic
+% git for-each-ref
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+% list_files
+d .git/patches
+d .git/patches/master
+d .git/refs/patches
+d .git/refs/patches/master
+d .git/refs/patches/topic
+f 22930c6d1f1938f298a4fca51c57e4b47171db21 .git/patches/master/mode
+f 413390f3906f16f30b054a4fb86c1e014b964504 .git/patches/master/remove
+f 9c18cc7abe6b87f18503714a80a677b4094eb457 .git/patches/master/add
+f bacb4aad8a55fe4e7aa58a9ae169990bb764069f .git/patches/master/series
+f bc9ab2e0f5db99d483961e956e814d963f0309f8 .git/patches/master/modify
+f da39a3ee5e6b4b0d3255bfef95601890afd80709 .git/patches/master/status
+% guilt new newpatch
+% git for-each-ref --format=%(refname)
+refs/heads/guilt/master
+refs/heads/master
+refs/patches/master/newpatch
+% guilt pop
+All patches popped.
+% guilt push
+Applying patch..newpatch
+Patch applied.
+% git for-each-ref
+25465dc1687f3833ecbd4e8bca437e522d7026db commit refs/heads/guilt/master
+d4850419ccc1146c7169f500725ce504b9774ed0 commit refs/heads/master
+25465dc1687f3833ecbd4e8bca437e522d7026db commit refs/patches/master/newpatch
+% git branch
+* guilt/master
+ master
+% guilt applied
+newpatch
+% guilt commit -a
+% git for-each-ref
+25465dc1687f3833ecbd4e8bca437e522d7026db commit refs/heads/master
+% git branch
+* master
+% guilt push -a
+Applying patch..modify
+Patch applied.
+Applying patch..add
+Patch applied.
+Applying patch..remove
+Patch applied.
+Applying patch..mode
+Patch applied.
+% guilt applied
+modify
+add
+remove
+mode
+% git branch
+* guilt/master
+ master
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit refs/heads/guilt/master
+25465dc1687f3833ecbd4e8bca437e522d7026db commit refs/heads/master
+5effcbeb303e8433935151d8c69f3bf63db1e8ef commit refs/patches/master/add
+fefbdcef61022d473838926619f31e030dd04fdc commit refs/patches/master/mode
+9509f22e2e627756d87b42432931c45955b74234 commit refs/patches/master/modify
+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit refs/patches/master/remove
+% guilt commit -n 2
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit refs/heads/guilt/master
+25465dc1687f3833ecbd4e8bca437e522d7026db commit refs/heads/master
+fefbdcef61022d473838926619f31e030dd04fdc commit refs/patches/master/mode
+9cbe2fc643b1a9e2179a8738f80424a1c2aa202d commit refs/patches/master/remove
+% git branch
+* guilt/master
+ master
+% guilt commit -n 2
+% git for-each-ref
+fefbdcef61022d473838926619f31e030dd04fdc commit refs/heads/master
+% git branch
+* master
+% guilt series
diff --git a/regression/t-061.sh b/regression/t-061.sh
new file mode 100755
index 0000000..1411baa
--- /dev/null
+++ b/regression/t-061.sh
@@ -0,0 +1,148 @@
+#!/bin/bash
+#
+# Test the branch-switching upgrade code
+#
+
+source $REG_DIR/scaffold
+
+old_style_branch() {
+ # Modify the refs so that it looks as if the patch series was applied
+ # by an old version of guilt.
+ cmd git update-ref refs/heads/$1 refs/heads/guilt/$1
+ cmd git symbolic-ref HEAD refs/heads/$1
+ cmd git update-ref -d refs/heads/guilt/$1
+}
+
+remove_topic() {
+ cmd guilt pop -a
+ if git rev-parse --verify --quiet guilt/master
+ then
+ cmd git checkout guilt/master
+ else
+ cmd git checkout master
+ fi
+ cmd guilt pop -a
+ cmd git branch -d $1
+ cmd rm -r .git/patches/$1
+ cmd git for-each-ref
+ cmd list_files
+}
+
+function fixup_time_info
+{
+ touch -a -m -t "$TOUCH_DATE" ".git/patches/master/$1"
+}
+
+cmd setup_repo
+
+cmd guilt push -a
+cmd list_files
+cmd git for-each-ref
+
+# Pop and push patches. Check that the repo is converted to new-style
+# refs when no patches are applied and a patch is pushed.
+old_style_branch master
+cmd git for-each-ref
+
+cmd list_files
+
+for i in `seq 5`
+do
+ cmd guilt pop
+ cmd git for-each-ref
+ cmd guilt push
+ cmd git for-each-ref
+ cmd guilt pop
+ cmd git for-each-ref
+done
+
+# Check that "pop -a" does the right thing.
+cmd guilt push -a
+
+old_style_branch master
+
+cmd git for-each-ref
+
+cmd guilt pop -a
+
+cmd git for-each-ref
+
+# Check that pushing two patches converts the repo to now-style (since
+# it currently has no patches applied).
+cmd guilt push add
+cmd git for-each-ref
+
+# Check guilt branch with a few patches applied.
+old_style_branch master
+cmd guilt branch topic
+cmd git for-each-ref
+
+# Check that the topic branch is converted to new-style.
+cmd guilt pop -a
+cmd guilt push
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check guilt branch with the full patch series applied.
+cmd guilt push -a
+old_style_branch master
+cmd guilt branch topic
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check guilt branch with no patches applied.
+# This gives us a new-style checkout.
+cmd guilt branch topic
+cmd git for-each-ref
+cmd list_files
+
+remove_topic topic
+
+# Check guilt branch in a new-style directory with all patches
+# applied. (Strictly speaking, this test should probably move to a
+# file devoted to testing "guilt branch".)
+cmd guilt push -a
+cmd guilt branch topic
+cmd git for-each-ref
+cmd list_files
+cmd guilt pop -a
+cmd git for-each-ref
+
+remove_topic topic
+
+# Check that "guilt new" does the right thing when no patches are
+# applied. (Strictly speaking, this test should maybe move to
+# t-025.sh).
+
+cmd guilt new newpatch
+cmd git for-each-ref '--format=%(refname)'
+cmd guilt pop
+fixup_time_info newpatch
+cmd guilt push
+cmd git for-each-ref
+
+# Check that "guilt commit" does the right thing when committing all
+# applied patches. (Strictly speaking, this test should maybe move to
+# t-030.sh).
+cmd git branch
+cmd guilt applied
+cmd guilt commit -a
+cmd git for-each-ref
+cmd git branch
+
+# Check that "guilt commit" does the right thing when committing only
+# a few of the applied patches. (Strictly speaking, this test should
+# maybe move to t-030.sh).
+cmd guilt push -a
+cmd guilt applied
+cmd git branch
+cmd git for-each-ref
+cmd guilt commit -n 2
+cmd git for-each-ref
+cmd git branch
+cmd guilt commit -n 2
+cmd git for-each-ref
+cmd git branch
+cmd guilt series
--
1.8.1
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox