[02/10] dim: Autocheck for up-to-dateness
diff mbox

Message ID 20161018121356.9594-2-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Oct. 18, 2016, 12:13 p.m. UTC
Exits script to annoy people roughly every 100th time ...

Also switch to the magic @{upstream} reference, in case the remote is
not called origin (which is pretty normal in case of using git
worktree).

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 dim | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Jani Nikula Oct. 18, 2016, 1:15 p.m. UTC | #1
On Tue, 18 Oct 2016, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> Exits script to annoy people roughly every 100th time ...

Annoyingly random, but we can improve this later.

LGTM.

> Also switch to the magic @{upstream} reference, in case the remote is
> not called origin (which is pretty normal in case of using git
> worktree).
>
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  dim | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/dim b/dim
> index 57ad4fcf9767..192d6ee10838 100755
> --- a/dim
> +++ b/dim
> @@ -176,13 +176,17 @@ function dim_uptodate
>  		exit 1
>  	fi
>  
> -	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\
> +	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show @{upstream}:dim |\
>  			diff "$using" - >& /dev/null; then
>  		echo "$dim: not running upstream version of the script." >&2
>  		exit 1
>  	fi
>  }
>  
> +if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
> +        dim_uptodate
> +fi
> +
>  # get message id from file
>  # $1 = file
>  message_get_id ()
Daniel Vetter Oct. 18, 2016, 1:27 p.m. UTC | #2
On Tue, Oct 18, 2016 at 04:15:01PM +0300, Jani Nikula wrote:
> On Tue, 18 Oct 2016, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > Exits script to annoy people roughly every 100th time ...
> 
> Annoyingly random, but we can improve this later.

I had it non-random, then realized it makes improving dim impossible ;-)
-Daniel
Jani Nikula Oct. 18, 2016, 2:04 p.m. UTC | #3
On Tue, 18 Oct 2016, Daniel Vetter <daniel@ffwll.ch> wrote:
> On Tue, Oct 18, 2016 at 04:15:01PM +0300, Jani Nikula wrote:
>> On Tue, 18 Oct 2016, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
>> > Exits script to annoy people roughly every 100th time ...
>> 
>> Annoyingly random, but we can improve this later.
>
> I had it non-random, then realized it makes improving dim impossible ;-)

I thought about just warning on every Nth day $((`date +%j` % N)) == 0,
and not exiting the script. Warning every time is annoying because it
talks to the network.

BR,
Jani.

Patch
diff mbox

diff --git a/dim b/dim
index 57ad4fcf9767..192d6ee10838 100755
--- a/dim
+++ b/dim
@@ -176,13 +176,17 @@  function dim_uptodate
 		exit 1
 	fi
 
-	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show origin/maintainer-tools:dim |\
+	if ! git --git-dir=$DIM_PREFIX/maintainer-tools/.git show @{upstream}:dim |\
 			diff "$using" - >& /dev/null; then
 		echo "$dim: not running upstream version of the script." >&2
 		exit 1
 	fi
 }
 
+if [[ "$((`date +%s` % 100))" -eq "0" ]] ; then
+        dim_uptodate
+fi
+
 # get message id from file
 # $1 = file
 message_get_id ()