git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* reflog for HEAD (detached or between branches)
@ 2007-01-26 22:25 Nicolas Pitre
  2007-01-26 23:45 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Pitre @ 2007-01-26 22:25 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git


This is the implementation for the idea I proposed for the support of
reflog with detached head.  In fact with this serie HEAD has a reflog
of its own which may or may not contain the same log entries found in
reflogs of individual branches.

Nicolas

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: reflog for HEAD (detached or between branches)
  2007-01-26 22:25 reflog for HEAD (detached or between branches) Nicolas Pitre
@ 2007-01-26 23:45 ` Junio C Hamano
  2007-01-27  1:46   ` [PATCH 1/3] create_symref: check error return from open() Junio C Hamano
  2007-01-27  1:49   ` [PATCH 3/3] write_in_full: size_t is unsigned Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-01-26 23:45 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git

I suspect that "git-reflog --expire", "git-fsck-objects" and
"git-prune" need to be updated to take the reflog associated
with the HEAD into account, as for_each_ref() does not call you
with HEAD.

Other than that, I think the series is beautifully done.

Thanks.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/3] create_symref: check error return from open().
  2007-01-26 23:45 ` Junio C Hamano
@ 2007-01-27  1:46   ` Junio C Hamano
  2007-01-27  1:49   ` [PATCH 3/3] write_in_full: size_t is unsigned Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-01-27  1:46 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git


Signed-off-by: Junio C Hamano <junkio@cox.net>
---

 * There seem to be similarly "casual" users of open in the rest
   of the code, but I noticed this while looking at your series.
   I've already done the necessary shuffling in my tree, so
   there is no need to resend your "move create_symref()".

 refs.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/refs.c b/refs.c
index 0840b3b..12e46b8 100644
--- a/refs.c
+++ b/refs.c
@@ -331,7 +331,11 @@ int create_symref(const char *ref_target, const char *refs_heads_master)
 		return -1;
 	}
 	lockpath = mkpath("%s.lock", git_HEAD);
-	fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);	
+	fd = open(lockpath, O_CREAT | O_EXCL | O_WRONLY, 0666);
+	if (fd < 0) {
+		error("Unable to open %s for writing", lockpath);
+		return -5;
+	}
 	written = write_in_full(fd, ref, len);
 	close(fd);
 	if (written != len) {
-- 
1.5.0.rc2.g8ac6-dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/3] write_in_full: size_t is unsigned.
  2007-01-26 23:45 ` Junio C Hamano
  2007-01-27  1:46   ` [PATCH 1/3] create_symref: check error return from open() Junio C Hamano
@ 2007-01-27  1:49   ` Junio C Hamano
  1 sibling, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2007-01-27  1:49 UTC (permalink / raw)
  To: Nicolas Pitre; +Cc: git

It received the return value from xwrite() in a size_t variable
'written' and expected comparison with 0 would catch an error
from xwrite().

Signed-off-by: Junio C Hamano <junkio@cox.net>
---
 * and this is the third bug t7207-co.sh caught.  I haven't
   bothered to look at the assembly, but I suspect the error
   return path could have been totally optimized out X-<.

 write_or_die.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/write_or_die.c b/write_or_die.c
index 046e79d..5c4bc85 100644
--- a/write_or_die.c
+++ b/write_or_die.c
@@ -23,7 +23,7 @@ int write_in_full(int fd, const void *buf, size_t count)
 	ssize_t total = 0;
 
 	while (count > 0) {
-		size_t written = xwrite(fd, p, count);
+		ssize_t written = xwrite(fd, p, count);
 		if (written < 0)
 			return -1;
 		if (!written) {
-- 
1.5.0.rc2.g8ac6-dirty

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-01-27  1:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-26 22:25 reflog for HEAD (detached or between branches) Nicolas Pitre
2007-01-26 23:45 ` Junio C Hamano
2007-01-27  1:46   ` [PATCH 1/3] create_symref: check error return from open() Junio C Hamano
2007-01-27  1:49   ` [PATCH 3/3] write_in_full: size_t is unsigned Junio C Hamano

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).