From 95a8d8589d8ae12d4c9237b33dceb69a4d97fd37 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Sat, 14 Feb 2009 20:18:24 +0100 Subject: [PATCH] Fixed problem with staging files in an empty repository --- gitg/gitg-commit.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gitg/gitg-commit.c b/gitg/gitg-commit.c index 35c5d686..165e45a8 100644 --- a/gitg/gitg-commit.c +++ b/gitg/gitg-commit.c @@ -449,8 +449,12 @@ update_index_staged(GitgCommit *commit, GitgChangedFile *file) { GFile *f = gitg_changed_file_get_file(file); gchar *path = gitg_repository_relative(commit->priv->repository, f); - gchar **ret = gitg_repository_command_with_outputv(commit->priv->repository, NULL, "diff-index", "--cached", "HEAD", path, NULL); + gchar *head = gitg_repository_parse_head(commit->priv->repository); + + gchar **ret = gitg_repository_command_with_outputv(commit->priv->repository, NULL, "diff-index", "--cached", head, "--", path, NULL); + g_free(path); + g_free(head); g_object_unref(f); if (!ret) @@ -480,7 +484,7 @@ update_index_unstaged(GitgCommit *commit, GitgChangedFile *file) { GFile *f = gitg_changed_file_get_file(file); gchar *path = gitg_repository_relative(commit->priv->repository, f); - gchar **ret = gitg_repository_command_with_outputv(commit->priv->repository, NULL, "diff-files", path, NULL); + gchar **ret = gitg_repository_command_with_outputv(commit->priv->repository, NULL, "diff-files", "--", path, NULL); g_free(path); g_object_unref(f);