summaryrefslogtreecommitdiff
path: root/refs.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <sahlberg@google.com>2014-05-15 15:25:23 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-10-15 17:47:21 (GMT)
commitdbdcac7d5c5eea314ec4c318a5e88cff427e9f0e (patch)
tree331de10ff6f3e42bd62911d0e8978a9a815a5109 /refs.c
parent9ccc0c089667e6dccc888590376f138521784e5e (diff)
downloadgit-dbdcac7d5c5eea314ec4c318a5e88cff427e9f0e.zip
git-dbdcac7d5c5eea314ec4c318a5e88cff427e9f0e.tar.gz
git-dbdcac7d5c5eea314ec4c318a5e88cff427e9f0e.tar.bz2
refs.c: add an err argument to delete_ref_loose
Add an err argument to delete_ref_loose so that we can pass a descriptive error string back to the caller. Pass the err argument from transaction commit to this function so that transaction users will have a nice error string if the transaction failed due to delete_ref_loose. Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'refs.c')
-rw-r--r--refs.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/refs.c b/refs.c
index 4f2564d..430857b 100644
--- a/refs.c
+++ b/refs.c
@@ -2597,7 +2597,7 @@ int repack_without_refs(const char **refnames, int n, struct strbuf *err)
return ret;
}
-static int delete_ref_loose(struct ref_lock *lock, int flag)
+static int delete_ref_loose(struct ref_lock *lock, int flag, struct strbuf *err)
{
if (!(flag & REF_ISPACKED) || flag & REF_ISSYMREF) {
/*
@@ -2605,9 +2605,9 @@ static int delete_ref_loose(struct ref_lock *lock, int flag)
* lockfile name, minus ".lock":
*/
char *loose_filename = get_locked_file_path(lock->lk);
- int err = unlink_or_warn(loose_filename);
+ int res = unlink_or_msg(loose_filename, err);
free(loose_filename);
- if (err)
+ if (res)
return 1;
}
return 0;
@@ -3658,7 +3658,8 @@ int ref_transaction_commit(struct ref_transaction *transaction,
struct ref_update *update = updates[i];
if (update->lock) {
- ret |= delete_ref_loose(update->lock, update->type);
+ ret |= delete_ref_loose(update->lock, update->type,
+ err);
if (!(update->flags & REF_ISPRUNING))
delnames[delnum++] = update->lock->ref_name;
}