Re: [PATCH v11 33/41] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-06-03 Thread Ronnie Sahlberg
On Fri, May 30, 2014 at 10:38 AM, Jonathan Nieder  wrote:
> Ronnie Sahlberg wrote:
>
>> Change the reference transactions so that we pass the reflog message
>> through to the create/delete/update function instead of the commit message.
>> This allows for individual messages for each change in a multi ref
>> transaction.
>
> Nice.
>
> That reminds me: in the future, do we want to have some way to figure
> out what ref updates happened together?  E.g., cvsnt introduced commit
> identifiers to answer a similar kind of question in CVS per-file
> history.  If some backend wants to support that, the API this patch
> introduces would handle it fine --- good.
>
> [...]
>> --- a/builtin/fetch.c
>> +++ b/builtin/fetch.c
>> @@ -673,10 +673,9 @@ static int store_updated_refs(const char *raw_url, 
>> const char *remote_name,
>>   }
>>   }
>>   }
>> -
>>   if (rc & STORE_REF_ERROR_DF_CONFLICT)
>>   error(_("some local refs could not be updated; try running\n"
>> -   " 'git remote prune %s' to remove any old, conflicting "
>> +   "'git remote prune %s' to remove any old, conflicting "
>> "branches"), remote_name);
>
> Unrelated change snuck in?

Yeah, there shouldn't be a space there.

>
> The rest of the patch is
> Reviewed-by: Jonathan Nieder 

Thanks!

>
> diff --git a/builtin/fetch.c b/builtin/fetch.c
> index faa1233..55f457c 100644
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -673,9 +673,10 @@ static int store_updated_refs(const char *raw_url, const 
> char *remote_name,
> }
> }
> }
> +
> if (rc & STORE_REF_ERROR_DF_CONFLICT)
> error(_("some local refs could not be updated; try running\n"
> - "'git remote prune %s' to remove any old, conflicting "
> + " 'git remote prune %s' to remove any old, conflicting "
>   "branches"), remote_name);
>
>   abort:
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v11 33/41] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-05-30 Thread Jonathan Nieder
Ronnie Sahlberg wrote:

> Change the reference transactions so that we pass the reflog message
> through to the create/delete/update function instead of the commit message.
> This allows for individual messages for each change in a multi ref
> transaction.

Nice.

That reminds me: in the future, do we want to have some way to figure
out what ref updates happened together?  E.g., cvsnt introduced commit
identifiers to answer a similar kind of question in CVS per-file
history.  If some backend wants to support that, the API this patch
introduces would handle it fine --- good.

[...]
> --- a/builtin/fetch.c
> +++ b/builtin/fetch.c
> @@ -673,10 +673,9 @@ static int store_updated_refs(const char *raw_url, const 
> char *remote_name,
>   }
>   }
>   }
> -
>   if (rc & STORE_REF_ERROR_DF_CONFLICT)
>   error(_("some local refs could not be updated; try running\n"
> -   " 'git remote prune %s' to remove any old, conflicting "
> +   "'git remote prune %s' to remove any old, conflicting "
> "branches"), remote_name);

Unrelated change snuck in?

The rest of the patch is
Reviewed-by: Jonathan Nieder 

diff --git a/builtin/fetch.c b/builtin/fetch.c
index faa1233..55f457c 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -673,9 +673,10 @@ static int store_updated_refs(const char *raw_url, const 
char *remote_name,
}
}
}
+
if (rc & STORE_REF_ERROR_DF_CONFLICT)
error(_("some local refs could not be updated; try running\n"
- "'git remote prune %s' to remove any old, conflicting "
+ " 'git remote prune %s' to remove any old, conflicting "
  "branches"), remote_name);
 
  abort:
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v11 33/41] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-05-27 Thread Ronnie Sahlberg
Change the reference transactions so that we pass the reflog message
through to the create/delete/update function instead of the commit message.
This allows for individual messages for each change in a multi ref
transaction.

Signed-off-by: Ronnie Sahlberg 
---
 branch.c   |  4 ++--
 builtin/commit.c   |  4 ++--
 builtin/fetch.c|  3 +--
 builtin/receive-pack.c |  5 +++--
 builtin/replace.c  |  4 ++--
 builtin/tag.c  |  4 ++--
 builtin/update-ref.c   | 13 +++--
 fast-import.c  |  8 
 refs.c | 36 ++--
 refs.h |  8 
 sequencer.c|  4 ++--
 walker.c   |  5 ++---
 12 files changed, 53 insertions(+), 45 deletions(-)

diff --git a/branch.c b/branch.c
index c1eae00..e0439af 100644
--- a/branch.c
+++ b/branch.c
@@ -301,8 +301,8 @@ void create_branch(const char *head,
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, sha1,
-  null_sha1, 0, !forcing, &err) ||
-   ref_transaction_commit(transaction, msg, &err))
+  null_sha1, 0, !forcing, msg, &err) ||
+   ref_transaction_commit(transaction, &err))
die("%s", err.buf);
ref_transaction_free(transaction);
}
diff --git a/builtin/commit.c b/builtin/commit.c
index 7db194f..608296c 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1721,8 +1721,8 @@ int cmd_commit(int argc, const char **argv, const char 
*prefix)
ref_transaction_update(transaction, "HEAD", sha1,
   current_head ?
   current_head->object.sha1 : NULL,
-  0, !!current_head, &err) ||
-   ref_transaction_commit(transaction, sb.buf, &err)) {
+  0, !!current_head, sb.buf, &err) ||
+   ref_transaction_commit(transaction, &err)) {
rollback_index_files();
die("%s", err.buf);
}
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 55f457c..faa1233 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -673,10 +673,9 @@ static int store_updated_refs(const char *raw_url, const 
char *remote_name,
}
}
}
-
if (rc & STORE_REF_ERROR_DF_CONFLICT)
error(_("some local refs could not be updated; try running\n"
- " 'git remote prune %s' to remove any old, conflicting "
+ "'git remote prune %s' to remove any old, conflicting "
  "branches"), remote_name);
 
  abort:
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index c88dc03..c91d3d6 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -594,8 +594,9 @@ static const char *update(struct command *cmd, struct 
shallow_info *si)
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_update(transaction, namespaced_name,
-  new_sha1, old_sha1, 0, 1, &err) ||
-   ref_transaction_commit(transaction, "push", &err)) {
+  new_sha1, old_sha1, 0, 1, "push",
+  &err) ||
+   ref_transaction_commit(transaction, &err)) {
const char *str = add_error_string(err.buf);
ref_transaction_free(transaction);
strbuf_release(&err);
diff --git a/builtin/replace.c b/builtin/replace.c
index f24d814..09bfd40 100644
--- a/builtin/replace.c
+++ b/builtin/replace.c
@@ -160,8 +160,8 @@ static int replace_object_sha1(const char *object_ref,
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_update(transaction, ref, repl, prev,
-  0, !is_null_sha1(prev), &err) ||
-   ref_transaction_commit(transaction, NULL, &err))
+  0, !is_null_sha1(prev), NULL, &err) ||
+   ref_transaction_commit(transaction, &err))
die("%s", err.buf);
 
ref_transaction_free(transaction);
diff --git a/builtin/tag.c b/builtin/tag.c
index c9bfc9a..74af63e 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -705,8 +705,8 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
transaction = ref_transaction_begin(&err);
if (!transaction ||
ref_transaction_update(transaction, ref.buf, object, prev,
-  0, !is_null_sha1(prev), &err) ||
-   ref_transaction_commit(transaction, NULL, &err))
+  0, !is_null_sha1(prev), NULL, &err) ||
+