Re: Git push failure in the case of SSH to localhost

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 11, 2009 at 8:05 PM, Jeff King <peff@xxxxxxxx> 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));
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux