From: David Turner <dturner@twopensource.com>
To: git@vger.kernel.org, mhagger@alum.mit.edu
Cc: David Turner <dturner@twopensource.com>
Subject: [PATCH 7/9] am/rebase: update pseudorefs by writing files
Date: Fri, 24 Jul 2015 00:45:27 -0400 [thread overview]
Message-ID: <1437713129-19373-8-git-send-email-dturner@twopensource.com> (raw)
In-Reply-To: <1437713129-19373-1-git-send-email-dturner@twopensource.com>
git update-ref can no longer be used to update pseudorefs, so in
git-am and git-rebase, we just directly edit the files.
Signed-off-by: David Turner <dturner@twopensource.com>
---
builtin/am.c | 6 +++---
contrib/examples/git-am.sh | 4 ++--
git-rebase--interactive.sh | 2 +-
git-rebase.sh | 2 +-
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/am.c b/builtin/am.c
index 3f0fc75..ff3eeee 100644
--- a/builtin/am.c
+++ b/builtin/am.c
@@ -1049,12 +1049,12 @@ static void am_setup(struct am_state *state, enum patch_format patch_format,
if (!get_sha1("HEAD", curr_head)) {
write_file(am_path(state, "abort-safety"), 1, "%s", sha1_to_hex(curr_head));
if (!state->rebasing)
- update_ref("am", "ORIG_HEAD", curr_head, NULL, 0,
- UPDATE_REFS_DIE_ON_ERR);
+ write_pseudoref("ORIG_HEAD", curr_head, NULL);
} else {
write_file(am_path(state, "abort-safety"), 1, "%s", "");
if (!state->rebasing)
- delete_ref("ORIG_HEAD", NULL, 0);
+ if (unlink(git_path("ORIG_HEAD")) && errno != ENOENT)
+ die("failed to unlink ORIG_HEAD");
}
/*
diff --git a/contrib/examples/git-am.sh b/contrib/examples/git-am.sh
index a3d0c84..a01a06e 100755
--- a/contrib/examples/git-am.sh
+++ b/contrib/examples/git-am.sh
@@ -614,9 +614,9 @@ Use \"git am --abort\" to remove it.")"
: >"$dotest/applying"
if test -n "$HAS_HEAD"
then
- git update-ref ORIG_HEAD HEAD
+ git rev-parse HEAD >"$GIT_DIR/ORIG_HEAD"
else
- git update-ref -d ORIG_HEAD >/dev/null 2>&1
+ rm -f "$GIT_DIR/ORIG_HEAD"
fi
fi
fi
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index f01637b..ae116a6 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -948,7 +948,7 @@ warn_lines () {
checkout_onto () {
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name"
output git checkout $onto || die_abort "could not detach HEAD"
- git update-ref ORIG_HEAD $orig_head
+ echo $orig_head >"$GIT_DIR/ORIG_HEAD"
}
get_missing_commit_check_level () {
diff --git a/git-rebase.sh b/git-rebase.sh
index 1757404..23e2e64 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -611,7 +611,7 @@ say "$(gettext "First, rewinding head to replay your work on top of it...")"
GIT_REFLOG_ACTION="$GIT_REFLOG_ACTION: checkout $onto_name" \
git checkout -q "$onto^0" || die "could not detach HEAD"
-git update-ref ORIG_HEAD $orig_head
+echo $orig_head >"$GIT_DIR/ORIG_HEAD"
# If the $onto is a proper descendant of the tip of the branch, then
# we just fast-forwarded.
--
2.0.4.315.gad8727a-twtrsrc
next prev parent reply other threads:[~2015-07-24 4:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 4:45 [PATCH/RFC 0/9] Pseudorefs David Turner
2015-07-24 4:45 ` [PATCH 1/9] refs: Introduce pseudoref and per-worktree ref concepts David Turner
2015-07-24 7:34 ` Eric Sunshine
2015-07-24 19:20 ` Junio C Hamano
2015-07-24 20:13 ` David Turner
2015-07-24 20:44 ` Junio C Hamano
2015-07-24 19:52 ` Philip Oakley
2015-07-24 20:14 ` David Turner
2015-07-24 4:45 ` [PATCH 2/9] notes: replace pseudorefs with real refs David Turner
2015-07-24 4:45 ` [PATCH 3/9] bisect: do not use update-ref for BISECT_HEAD David Turner
2015-07-24 4:45 ` [PATCH 4/9] tests: treat FETCH_HEAD as a pseudoref David Turner
2015-07-24 4:45 ` [PATCH 5/9] tests: use --create-reflog option to git update-ref David Turner
2015-07-24 4:45 ` [PATCH 6/9] pseudorefs: create and use pseudoref update and delete functions David Turner
2015-07-24 19:25 ` Junio C Hamano
2015-07-24 20:17 ` David Turner
2015-07-24 20:53 ` Junio C Hamano
2015-07-24 4:45 ` David Turner [this message]
2015-07-24 4:45 ` [PATCH 8/9] rebase: use write_pseudoref David Turner
2015-07-24 4:45 ` [PATCH 9/9] refs: forbid pseudoref updates through ref update API David Turner
2015-08-02 22:48 ` [PATCH/RFC 0/9] Pseudorefs Michael Haggerty
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=1437713129-19373-8-git-send-email-dturner@twopensource.com \
--to=dturner@twopensource.com \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
/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).