From: Junio C Hamano <gitster@pobox.com>
To: Samuel Lucas Vaz de Mello <samuellucas@datacom.ind.br>
Cc: git@vger.kernel.org, "Shawn O. Pearce" <spearce@spearce.org>
Subject: Re: [PATCH] Preserve file permissions on git-reflog expire
Date: Wed, 15 Oct 2008 10:54:15 -0700 [thread overview]
Message-ID: <7v3aix4ud4.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <48F629C2.70203@datacom.ind.br> (Samuel Lucas Vaz de Mello's message of "Wed, 15 Oct 2008 14:34:58 -0300")
Samuel Lucas Vaz de Mello <samuellucas@datacom.ind.br> writes:
> Preserve file permissions on git-reflog expire to avoid problems with shared repositories and git-gc.
Looong line needs wrapped (I could do this myself if this was the only
issue, but...)
> Signed-off-by: Samuel Lucas Vaz de Mello <samuellucas@datacom.ind.br>
>
> ---
>
> This small patch fixes a bug with shared repositories and git-reflog expire.
> samuel@erdinger:~/myrepo$ git push
> Counting objects: 5, done.
> Compressing objects: 100% (3/3), done.
> Unpacking objects: 100% (3/3), done.
> Writing objects: 100% (3/3), 295 bytes, done.
> Total 3 (delta 2), reused 0 (delta 0)
> error: Unable to append to logs/refs/heads/master: Permission denied
> To /remote/myrepo/
> ! [remote rejected] master -> master (failed to write)
> error: failed to push some refs to '/remote/myrepo/'
Thanks for a reproduction recipe. I think an abbreviated version of this
would deserve to be in the commit log message proper.
> diff --git a/builtin-reflog.c b/builtin-reflog.c
> index 6b3667e..92a0d53 100644
> --- a/builtin-reflog.c
> +++ b/builtin-reflog.c
> @@ -265,6 +265,7 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> struct cmd_reflog_expire_cb *cmd = cb_data;
> struct expire_reflog_cb cb;
> struct ref_lock *lock;
> + struct stat filestat;
> char *log_file, *newlog_path = NULL;
> int status = 0;
>
> @@ -303,6 +304,10 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
> status |= error("Couldn't write %s",
> lock->lk->filename);
> unlink(newlog_path);
> + } else if (stat(log_file, &filestat)){
> + status |= error("unable to read permissions of %s", log_file);
Hmmm. Is there a reason you did not use adjust_shared_perm() like all the
other codepaths for creating files under .git/ directory do?
next prev parent reply other threads:[~2008-10-15 17:55 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-15 17:34 [PATCH] Preserve file permissions on git-reflog expire Samuel Lucas Vaz de Mello
2008-10-15 17:54 ` Junio C Hamano [this message]
2008-10-16 12:34 ` Johannes Schindelin
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=7v3aix4ud4.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=samuellucas@datacom.ind.br \
--cc=spearce@spearce.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.