From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_HI,RCVD_IN_SORBS_SPAM, RP_MATCHES_RCVD shortcircuit=no autolearn=no autolearn_force=no version=3.4.0 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by dcvr.yhbt.net (Postfix) with ESMTP id C130A20960 for ; Wed, 12 Apr 2017 06:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752508AbdDLGbD (ORCPT ); Wed, 12 Apr 2017 02:31:03 -0400 Received: from mail-oi0-f53.google.com ([209.85.218.53]:36684 "EHLO mail-oi0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751159AbdDLGbC (ORCPT ); Wed, 12 Apr 2017 02:31:02 -0400 Received: by mail-oi0-f53.google.com with SMTP id r203so21098904oib.3 for ; Tue, 11 Apr 2017 23:31:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=t/rJSkIxV5rS4ZuVdMJn5DfMsmbrsskHOsxi8YhQ7Z8=; b=HiMZEuX/Var+yklSlHW1KSxOYz6m1yDv9Y8OaRBUZ90Cftlvwr7YS2cHR8PS4xOqFo P5ssapopV7M9pTfDP2490obtk8lJFbRVeQUmOJgpMh4hTEjxQXs48VD4yGE5+hCg/hya OVbV9zFFa/o0Ks7mLgVaP9O5QaUolcIrcmx0TrLv3yWjH+gO7ep2uoYcNSzuriYGru4X gdwYmmmwIhNGa9P50j2q1e+VUX/o6Gc1JEJdUmajfqzd2SM3SF1mj11CyQhex/R/Or5g yXLp97nkxuoT9QEk7z0ocGlnpX6OGbqHw9ZsnmXnNp1T1KIR5gN0/TTvOn+VrvmdlfhK RK4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=t/rJSkIxV5rS4ZuVdMJn5DfMsmbrsskHOsxi8YhQ7Z8=; b=QlHkJtk7jZ6pWz55qzW8+vdQ6ttTf2PY+CrTq36rcsKO5rYOaq19QAdKDRWG60EDmV ERwZl5jpttynfVdZLCxI0eYhWYksSNuU0EfwAji57L4pH4fMz8Co6YzWxodVLDLtDwXB aOkxMNrqfg6dGrulLJ5C7QziBs83lsdvyxB7WN44c7hnbqxRGeOn2Wm2Pq9TlLIBb3ea PY5u8IQ4SSa3PCILybKoqAsu3/v6+KHh2Nfx/15nMuqt/yMqfi6gLz7gvnt8nHNRfSzP AboZSbHMBp0wA1aOmkJwXhytvXr5kRHRoBQzMOjYgsazmcPnEAVC9IfAQA1QFJBIohHq GDgw== X-Gm-Message-State: AN3rC/4knGjwnmYGihU8BAKVsvcQFhrcoZ3aDGQz7pcFrhuLr5Gd2Gv/WnHk+k7/y/kVTuuP6ixnxiUvPxlrCA== X-Received: by 10.157.40.243 with SMTP id s106mr6616692ota.271.1491978661555; Tue, 11 Apr 2017 23:31:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.74.158.70 with HTTP; Tue, 11 Apr 2017 23:30:31 -0700 (PDT) In-Reply-To: <20170410171352.s7r7tzheadxjlulw@sigill.intra.peff.net> References: <20170409022128.21337-1-danny@dannysauer.com> <413a1456-cac6-56c8-ea45-38f14cf958ae@dannysauer.com> <20170410171352.s7r7tzheadxjlulw@sigill.intra.peff.net> From: Duy Nguyen Date: Wed, 12 Apr 2017 13:30:31 +0700 Message-ID: Subject: Re: [PATCH] Make git log work for git CWD outside of work tree To: Jeff King Cc: Junio C Hamano , Danny Sauer , Git Mailing List , Johannes Schindelin Content-Type: text/plain; charset=UTF-8 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org On Tue, Apr 11, 2017 at 12:13 AM, Jeff King wrote: > On Mon, Apr 10, 2017 at 07:01:00PM +0700, Duy Nguyen wrote: >> An alternative is, when you have found out you need to read .mailmap, >> you call setup_work_tree() then, which prepares the worktree for you >> (including moving back to cwd) or dies if worktree does not exist, or >> no-op if worktree has already been asked by somebody. Many commands do >> lazy worktree initialization this way. > > I think this is much more than just .mailmap, though. For instance, I > have noticed a similar problem with .gitattributes: Urgh. assuming that we should not read .gitattributes if there's no worktree to read from (similar to the "defaults to .git" situation), how about - if mailmap stuff is requested, setup worktree, or die trying - if worktree is detected, but setup code does not jump to it, do it - if no worktree is detected, tell git-log to stop reading .gitattributes We probablly want some "if no wotktree then die()" in .gitattributes and .gitignore code, just in case it's incorrectly and accidentally executed in exotic setup -- Duy