Re: [PATCH 2/7] Refactor of RefUpdate force to call common updateImpl instead of duplication

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

 



Charles O'Farrell <charleso@xxxxxxxxxxxx> wrote:
> @@ -266,31 +266,8 @@ public class RefUpdate {
>  	 *             an unexpected IO error occurred while writing changes.
>  	 */
>  	public Result forceUpdate() throws IOException {
[clipped uinteresting deletions to show only the postimage]
> +		force = true;
> +		return update();
>  	}
>  
>  	/**
> @@ -347,6 +324,12 @@ public class RefUpdate {
>  			if (oldValue == null)
>  				return store(lock, Result.NEW);
>  
> +			if (isForceUpdate()) {
> +				if (oldValue.equals(newValue))
> +					return Result.NO_CHANGE;
> +				return store(lock, Result.FORCED);
> +			}
> +
>  			newObj = walk.parseAny(newValue);
>  			oldObj = walk.parseAny(oldValue);
>  			if (newObj == oldObj)
> @@ -355,13 +338,8 @@ public class RefUpdate {
>  			if (newObj instanceof RevCommit && oldObj instanceof RevCommit) {
>  				if (walk.isMergedInto((RevCommit) oldObj, (RevCommit) newObj))
>  					return store(lock, Result.FAST_FORWARD);
> -				if (isForceUpdate())
> -					return store(lock, Result.FORCED);
> -				return Result.REJECTED;

The problem with this change is that calls to just update() which
have isForceUpdate() true but actually turn out to be FAST_FORWARD
types of updates now report FORCED as the result.  We don't want
to always report FORCED if the application is using just update().

Its nice to know that the remote side didn't rewind since we last
saw them (for example).

-- 
Shawn.
--
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