From: "Ciprian Dorin, Craciun" <ciprian.craciun@gmail.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: Git push failure in the case of SSH to localhost
Date: Wed, 11 Feb 2009 20:42:25 +0200 [thread overview]
Message-ID: <8e04b5820902111042q138a2e79vc97c533007482e5c@mail.gmail.com> (raw)
In-Reply-To: <20090211180559.GC19749@coredump.intra.peff.net>
On Wed, Feb 11, 2009 at 8:05 PM, Jeff King <peff@peff.net> wrote:
> On Wed, Feb 11, 2009 at 06:24:29PM +0200, Ciprian Dorin, Craciun wrote:
>
>> 15 git push file:///tmp/r2 master
>> Counting objects: 3, done.
>> Writing objects: 100% (3/3), 197 bytes, done.
>> Total 3 (delta 0), reused 0 (delta 0)
>> error: unpack should have generated
>> ea8c5601f49a4bdeea03db3adb909d590ea730d3, but I can't find it!
>> To file:///tmp/r2
>> ! [remote rejected] master -> master (bad pack)
>> error: failed to push some refs to 'file:///tmp/r2'
>
> I can't reproduce the problem here. It looks like your receive-pack is
> somehow broken (which should be the only difference between pushing to a
> local repo and a remote one).
>
> Can you try with a vanilla version of git to be sure it is not your
> add-on patch responsible?
>
> -Peff
Indeed it seems it's from my patch... Because with a vanila
1.6.1.1 it works perfectly... I'll dig into what I've done, although I
couldn't imagine that it was from my patch...
For now I see that the problem comes from the function
setup_git_directory_gentry which I call inside the setup_path function
in exec_cmd.c
Can someone help? (My patch is below...)
Thanks,
Ciprian Craciun.
--------
diff --git a/exec_cmd.c b/exec_cmd.c
index cdd35f9..1513ee0 100644
--- a/exec_cmd.c
+++ b/exec_cmd.c
@@ -44,6 +44,44 @@ const char *git_exec_path(void)
return system_path(GIT_EXEC_PATH);
}
+/* Returns the path of the bin folder inside the .git folder. */
+/* (This could be used to store repository specific git programs.) */
+const char *git_repo_exec_path(void)
+{
+ static char path_buffer[PATH_MAX + 1];
+ static char *path = NULL;
+
+ int non_git;
+ const char *git_dir;
+ char cwd[PATH_MAX + 1];
+
+ if (!path) {
+
+ path = path_buffer;
+ path[0] = '\0';
+
+ if (!getcwd(cwd, PATH_MAX))
+ die("git_repo_exec_path: can not getcwd");
+
+ setup_git_directory_gently(&non_git);
+
+ if (!non_git) {
+
+ git_dir = get_git_dir();
+ strncat(path, git_dir, PATH_MAX);
+ strncat(path, "/", PATH_MAX);
+ strncat(path, "bin", PATH_MAX);
+
+ strncpy(path, make_absolute_path(path), PATH_MAX);
+
+ if (chdir(cwd))
+ die("git_repo_exec_path: can not chdir to '%s'", cwd);
+ }
+ }
+
+ return path;
+}
+
static void add_path(struct strbuf *out, const char *path)
{
if (path && *path) {
@@ -61,6 +99,7 @@ void setup_path(void)
const char *old_path = getenv("PATH");
struct strbuf new_path = STRBUF_INIT;
+ add_path(&new_path, git_repo_exec_path());
add_path(&new_path, argv_exec_path);
add_path(&new_path, getenv(EXEC_PATH_ENVIRONMENT));
add_path(&new_path, system_path(GIT_EXEC_PATH));
next prev parent reply other threads:[~2009-02-11 18:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-11 16:24 Git push failure in the case of SSH to localhost Ciprian Dorin, Craciun
2009-02-11 18:05 ` Jeff King
2009-02-11 18:42 ` Ciprian Dorin, Craciun [this message]
2009-02-11 18:44 ` Jeff King
2009-02-11 19:03 ` Ciprian Dorin, Craciun
2009-02-11 19:14 ` Shawn O. Pearce
2009-02-11 19:20 ` Ciprian Dorin, Craciun
2009-02-11 19:22 ` Jeff King
2009-02-11 19:32 ` Ciprian Dorin, Craciun
2009-02-11 19:42 ` Jeff King
2009-02-11 20:03 ` Ciprian Dorin, Craciun
2009-02-11 20:23 ` Junio C Hamano
2009-02-11 20:49 ` Ciprian Dorin, Craciun
2009-02-11 21:03 ` Johannes Schindelin
2009-02-11 19:27 ` Junio C Hamano
2009-02-11 19:34 ` Ciprian Dorin, Craciun
2009-02-11 19:40 ` Junio C Hamano
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=8e04b5820902111042q138a2e79vc97c533007482e5c@mail.gmail.com \
--to=ciprian.craciun@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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).