From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Pierre Habouzit <madcoder@debian.org>
Subject: [PATCH] git-send-pack: don't consider branch lagging behind as errors.
Date: Thu, 19 Jun 2008 12:51:55 +0200 [thread overview]
Message-ID: <1213872715-11182-1-git-send-email-madcoder@debian.org> (raw)
It's really painful to have git push error out when it's just that one of
your tracking branches isn't up to date with respect to a remote branch.
Let just add a new status: "lagging", always print it to screen when we're
lagging, but don't exit with a non 0 value, as it really alarms users.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
"lagging" is probably not a very nice name, and anyone is welcomed to use
a better word for the concept.
Another little glitch is that with this patch you can see:
$ git push
To {your-remote}
< [lagging] {local-branch} -> {remote-branch}
Everything up-to-date
The "Everything up-to-date" is slightly confusing, so maybe we should make it
better like "Everything up-to-date or strict parent" or whatever.
builtin-send-pack.c | 10 +++++++++-
cache.h | 1 +
2 files changed, 10 insertions(+), 1 deletions(-)
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 8d1e7be..cfbc108 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -339,6 +339,9 @@ static int print_one_push_status(struct ref *ref, const char *dest, int count)
print_ref_status('=', "[up to date]", ref,
ref->peer_ref, NULL);
break;
+ case REF_STATUS_LAGGING_BEHIND:
+ print_ref_status('<', "[lagging]", ref, ref->peer_ref, NULL);
+ break;
case REF_STATUS_REJECT_NONFASTFORWARD:
print_ref_status('!', "[rejected]", ref, ref->peer_ref,
"non-fast forward");
@@ -390,6 +393,7 @@ static int refs_pushed(struct ref *ref)
switch(ref->status) {
case REF_STATUS_NONE:
case REF_STATUS_UPTODATE:
+ case REF_STATUS_LAGGING_BEHIND:
break;
default:
return 1;
@@ -568,7 +572,10 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
|| !ref_newer(new_sha1, ref->old_sha1));
if (ref->nonfastforward && !ref->force && !args.force_update) {
- ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
+ if (ref_newer(ref->old_sha1, new_sha1))
+ ref->status = REF_STATUS_LAGGING_BEHIND;
+ else
+ ref->status = REF_STATUS_REJECT_NONFASTFORWARD;
continue;
}
@@ -628,6 +635,7 @@ static int do_send_pack(int in, int out, struct remote *remote, const char *dest
switch (ref->status) {
case REF_STATUS_NONE:
case REF_STATUS_UPTODATE:
+ case REF_STATUS_LAGGING_BEHIND:
case REF_STATUS_OK:
break;
default:
diff --git a/cache.h b/cache.h
index 23f3b92..b9b32eb 100644
--- a/cache.h
+++ b/cache.h
@@ -673,6 +673,7 @@ struct ref {
REF_STATUS_UPTODATE,
REF_STATUS_REMOTE_REJECT,
REF_STATUS_EXPECTING_REPORT,
+ REF_STATUS_LAGGING_BEHIND,
} status;
char *remote_status;
struct ref *peer_ref; /* when renaming */
--
1.5.6.rc3.158.g1a80c.dirty
next reply other threads:[~2008-06-19 10:53 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-06-19 10:51 Pierre Habouzit [this message]
2008-06-19 13:37 ` [PATCH] git-send-pack: don't consider branch lagging behind as errors Jeff King
2008-06-19 13:52 ` Pierre Habouzit
2008-06-19 15:11 ` Jeff King
2008-06-19 16:28 ` Pierre Habouzit
2008-06-19 18:33 ` Junio C Hamano
2008-06-20 9:55 ` Pierre Habouzit
2008-06-20 22:14 ` しらいしななこ
2008-06-26 7:50 ` Jeff King
2008-06-26 8:19 ` Junio C Hamano
2008-06-26 13:28 ` Pierre Habouzit
2008-06-28 4:33 ` Jeff King
2008-06-28 4:34 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1213872715-11182-1-git-send-email-madcoder@debian.org \
--to=madcoder@debian.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).