Re: [PATCH v8 36/44] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-05-22 Thread Ronnie Sahlberg
On Wed, May 21, 2014 at 4:47 PM, Jonathan Nieder jrnie...@gmail.com 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.

 Nice.

 [...]
 --- a/builtin/fetch.c
 +++ b/builtin/fetch.c
 @@ -673,7 +673,6 @@ 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 

 Stray whitespace change?

Fixed.


 [...]
 --- a/refs.c
 +++ b/refs.c
 [...]
 @@ -3264,6 +3264,7 @@ struct ref_update {
   int have_old; /* 1 if old_sha1 is valid, 0 otherwise */
   struct ref_lock *lock;
   int type;
 + const char *msg;
   const char refname[FLEX_ARRAY];

 Should be 'char *msg' since we own the memory (or perhaps a strbuf).

I changed it to char *msg, but it still might/should be const. We own
the memory but we are not supposed to modify the content
(after we have copied what the caller gave us).

Yes, we should change it into a strbuf at some stage.


 [...]
 @@ -3297,9 +3298,10 @@ void ref_transaction_free(struct ref_transaction 
 *transaction)
   if (!transaction)
   return;

 - for (i = 0; i  transaction-nr; i++)
 + for (i = 0; i  transaction-nr; i++) {
 +   free((char *)transaction-updates[i]-msg);
   free(transaction-updates[i]);

 Whitespace?

Fixed.


 No need to cast.

Done.

Thanks!
ronnie sahlberg
--
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 v8 36/44] refs.c: pass the ref log message to _create/delete/update instead of _commit

2014-05-21 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.

Nice.

[...]
 --- a/builtin/fetch.c
 +++ b/builtin/fetch.c
 @@ -673,7 +673,6 @@ 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 

Stray whitespace change?

[...]
 --- a/refs.c
 +++ b/refs.c
[...]
 @@ -3264,6 +3264,7 @@ struct ref_update {
   int have_old; /* 1 if old_sha1 is valid, 0 otherwise */
   struct ref_lock *lock;
   int type;
 + const char *msg;
   const char refname[FLEX_ARRAY];

Should be 'char *msg' since we own the memory (or perhaps a strbuf).

[...]
 @@ -3297,9 +3298,10 @@ void ref_transaction_free(struct ref_transaction 
 *transaction)
   if (!transaction)
   return;
  
 - for (i = 0; i  transaction-nr; i++)
 + for (i = 0; i  transaction-nr; i++) {
 +   free((char *)transaction-updates[i]-msg);
   free(transaction-updates[i]);

Whitespace?

No need to cast.

The rest of the patch looks good.

Thanks,
Jonathan
--
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